4
votes

I am using mongodump command to dump mongodb data, but when I am restoring it using mongorestore it changes order of documents (order in which documents was inserted), What might be the issue? Is there any way by which I can preserve insertion order?

1

1 Answers

7
votes

You can use "maintainInsertionOrder" to preserve the insertion order. The default is False.

--maintainInsertionOrder

Default: False

If specified, mongorestore inserts the documents in the order of their appearance in the input source, otherwise mongorestore may perform the insertions in an arbitrary order.