mongodb查询不为空怎么写?
 
                    yang
2020-06-02 11:41:477429浏览 · 0收藏 · 0评论

mongodb中查询不为null并且存在记录的语句如下:
db.test.find({"test":{"$ne":null}});
db.test.find({"test":{"$ne":null, $exists:true}});mongodb中查询存在且不为null,不为""(空字符串)
List testList = new ArrayList<>();
 
testList .add(null);
 
testList .add("");
 
queryUser.put("test", new BasicDBObject("$nin", testList));更多mongodb相关文章请关注python自学网
 
                    关注公众号,随时随地在线学习

