在这篇文章中,我们来学习一下“MongoDB中查询不为空的SQL语句是什么”的相关知识,下文有详细的讲解,易于大家学习和理解,有需要的朋友可以借鉴参考,下面就请大家跟着小编的思路一起来学习一下吧。
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中查询不为空的SQL语句是什么”的相关知识,感谢各位的阅读。