您好,欢迎来到二三四教育网。
搜索
您的当前位置:首页mongodb查询不为空怎么写?

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相关文章请关注

本文如未解决您的问题请添加抖音号:51dongshi(抖音搜索懂视),直接咨询即可。

热门图文

Copyright © 2019-2025 how234.cn 版权所有 赣ICP备2023008801号-2

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务