How do MongoDB multi-keys sort?
问题 In MongoDB, a field can have multiple values (an array of values). Each of them is indexed, so you can filter on any of the values. But can you also "order by" a field with multiple values and what is the result? Update: > db.test.find().sort({a:1}) { "_id" : ObjectId("4f27e36b5eaa9ebfda3c1c53"), "a" : [ 0 ] } { "_id" : ObjectId("4f27e3845eaa9ebfda3c1c54"), "a" : [ 0, 1 ] } { "_id" : ObjectId("4f27df6e5eaa9ebfda3c1c4c"), "a" : [ 1, 1, 1 ] } { "_id" : ObjectId("4f27df735eaa9ebfda3c1c4d"), "a"