zoukankan      html  css  js  c++  java
  • mongodb查询字段为null和存在不存在

    https://blog.csdn.net/majinggogogo/article/details/48913007

    查询集合c中y的值为null或者不存在

    db.c.find({y: null})

    查询集合c中y的值为null,(仅返回y的值为null的数据,不会返回不存在的)

    db.c.find({“y”: {$type : 10}})
    $type为10表示Null

    或者
    db.c.find({“y”: {“$in”: [null], “$exists”: true}})

    查询集合c中y的值不存在(不会返回y的值为null的数据)

    db.c.find({“y”: {$exists: false}})

    查询集合c中y的值不为null且存在的记录

    db.c.find({“y”: {"$ne": null, $exists: true}})

    或者
    db.c.find({“y”: {"$ne":null}})

    https://mongoing.com/docs/tutorial/query-for-null-fields.html

  • 相关阅读:
    python
    redis
    mongodb replica on aws ec2
    mysql
    java正则表达式
    终端make命令和Git学习
    linux和shell学习
    centos普通用户安装jenkins
    centos7普通用户安装jdk
    WPF动画
  • 原文地址:https://www.cnblogs.com/liuzhenwei/p/14166542.html
Copyright © 2011-2022 走看看