Query Result Order Difference Between MongoDB and AWS DocumentDB

0

Hello,

I am migrating a database from MongoDB to AWS DocumentDB. I have observed that when I query a collection with the same elements in both MongoDB and DocumentDB, the order of the results is different.

Is this a known behavior of query results on DocumentDB?

Thank you.

asked 25 days ago73 views
1 Answer
1
Accepted Answer

Hello,

It's one of the function difference with MongoDB.

https://docs.aws.amazon.com/documentdb/latest/developerguide/functional-differences.html#functional-differences.result-ordering

Amazon DocumentDB does not guarantee implicit result sort ordering of result sets. To ensure the ordering of a result set, explicitly specify a sort order using sort().

profile picture
answered 25 days ago
profile picture
EXPERT
reviewed 25 days ago
  • So basically, since MongoDB does not guarantee implicit result sort ordering, the sort ordering in DocumentDB won't be the same as in MongoDB. Right?

  • yes, but you could explicitly specify a sort order using sort().

  • yea, unfortunately i need exactly the implicit sort order like in Mongo

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions