Can MongoDB and its drivers preserve the ordering of document elements

前端 未结 4 1097
一生所求
一生所求 2020-12-06 06:06

I am considering using MongoDB to store documents that include a list of key/value pairs. The safe but ugly and bloated way to store this is as

[ [\'k1\' :          


        
4条回答
  •  不思量自难忘°
    2020-12-06 06:28

    One of the pain points of this is comparing documents to one another in the shell.

    I've created a project that creates a custom mongorc.js which sorts the document keys by default for you when they are printed out so at least you can see what is going on clearly in the shell. It's called Mongo Hacker if you want to give it a whirl.

提交回复
热议问题