mongodb查询不为空怎么写?

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教程网
来源:PY学习网:原文地址:https://www.py.cn/article.html

