Detection field exists in mongodb

文章来自我的博客:http://lwxshow.com/detection-field-exists-in-mongodb

#查找包含post的列 测试包含post列是否存在

在mongodb检测字段是否存在

db.cuser.find({post:{$exists:1}});
{ "_id" : ObjectId("51a23348ea214a8ee3204de1"), "age" : 1, "name" : "userid_1", "post" : [ 1, 2, 3, 4, 5 ], "pwd" : "pwd_1" }


你可能感兴趣的:(mongodb,exists,Field,lwxshow,detection)