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

  • 相关阅读:
    数组迭代方法
    promise
    Gulp执行预处理
    第一个gulp 项目
    vue 单元素过渡
    webpack 入门
    webpack初始化
    v-for 指令
    ajax 工作原理
    面试小问题
  • 原文地址:https://www.cnblogs.com/liuzhenwei/p/14166542.html
Copyright © 2011-2022 走看看