Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
db.posts.insert({ title: "Hello World", "2d": [1,2], "3d": [3,4,5], "4d": [6,7,8,9], "6d: [1,2,3,4,5,6] });
每个文档只能有2d列,或者只有3d列,或者只有两者,或者只有4dand2d等。如何找到具有该特定列的文档?
2d
3d
4d
SELECT * FROM posts where posts.hascolumn=2d
^仅作示范。
您可以使用db.posts.find({"2d" : {$exists:true})
db.posts.find({"2d" : {$exists:true})