python - Modify the order in which properties are displayed in MongoDB -
i using pymongo insert data (title, description, phone_number ...)
mongodb. however, when use mongo
client view data, displays properties in strange order. specifically, phone_number
property displayed first, followed title
, comes description
. there way can force particular order?
mongodb documents bson objects, unordered dictionaries of key-value pairs. so, can't rely on or set specific fields order. thing can operate fields display , not to, see docs on find's projection argument.
also see related questions on so:
- mongodb field order , document position change after update
- can mongodb , drivers preserve ordering of document elements
- ordering fields find query projection
hope helps.
Comments
Post a Comment