I'm trying to order my collection using the following query:
db.getCollection('trip').find().sort({'itinerary.0.timestamp': 1})
The result is not being correctly sorted, however I exported the full collection to a local mongoDB database and the same query works like a charm. In order to perform that sort in cosmos DB I had to create the index 'itinerary.0.timestamp'
.
data example:
{ "_id" : ObjectId("6087104ca68f171ce7715448"), "tripId" : NumberLong(38533184), "itinerary" : [ { "transId" : NumberLong(39800097), "timestamp" : NumberLong(1619372446291) }, { "transId" : NumberLong(39800576), "timestamp" : NumberLong(1619372446321) }, ], "results" : [], "tripTimeSent" : ISODate("2021-04-29T14:44:53.253Z") }
What am I missing? Thanks!!
https://stackoverflow.com/questions/67308790/issue-with-cosmos-db-collection-order April 29, 2021 at 06:38AM
没有评论:
发表评论