mongomock
mongomock copied to clipboard
Change insertion order of keys in data dicts maintained in Collection._store
Some external libraries (mongoengine is one example), depend on the insertion order of the fields in the dict returned by pymongo, specifically in this fix that the "_id" field is first. I've confirmed that this is how pymongo is providing the data.
Incidentally, this also fixes https://github.com/mongomock/mongomock/issues/641