mongodb查询不为空怎么写?

276次阅读
没有评论

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自学网

神龙|纯净稳定代理IP免费测试>>>>>>>>天启|企业级代理IP免费测试>>>>>>>>IPIPGO|全球住宅代理IP免费测试

相关文章:

版权声明:MongoDB2022-12-06发表,共计303字。
新手QQ群:570568346,欢迎进群讨论 Python51学习