zoukankan      html  css  js  c++  java
  • MongoDB查询

    1、为null或者不存在

    db.test.find({"test":null});
    

    2、不为null并且存在记录

    db.test.find({"test":{"$ne":null}});
    db.test.find({"test":{"$ne":null, $exists:true}});
    

    3.存在

    db.test.find({"test":{$exists:true}});
    

    4.不存在(不会返回null的值)

    db.test.find({"test":{$exists:false}});
    
     # for i in db.find({"title":{"$nin":["",None]}},{"_id":False,"title":True}):  # 过滤即不等空字符串又不等于None
        for i in db.find({"title":{"$ne":""}},{"_id":False,"title":True}): # 过滤不等于空字符串
            f.write(str(i["title"]) + "
    ")
  • 相关阅读:
    X
    W
    J
    A
    Q
    P
    B
    排列和组合的求解
    深度学习之序列处理
    32位和64位数据类型大小对比
  • 原文地址:https://www.cnblogs.com/wang102030/p/11950581.html
Copyright © 2011-2022 走看看