首页 > IT职业 > IT生活 > mongodb如何筛选不等于空的字段

mongodb筛选不等于空的字段的方法:
在mongodb数据库中表示非空的方法有(not null)和($ne:null)两种方法
使用“find{{字段:{$ne:null}}}”方法就可以筛选非空的字段了
示例如下:
db.getCollection("xttblog").find({type:{$ne:null}})
db.getCollection("xttblog").find({type:{not null}})
更多Python知识,请关注:Python自学网!!
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/4715/viewspace-2833158/ ,如需转载,请注明出处,否则将追究法律责任。