简体   繁体   English

MongoDb Where 子句中的嵌套查询

[英]Nested Query In MongoDb Where Clause

i'm quite new and i can't find any query that matches my output.我很新,我找不到任何与我的 output 匹配的查询。

for ex, i have data look like:例如,我的数据如下:

{_id:1, 
  name:a,  
  "date" : {
    "request" : 2020-02-02,
    "validate" : 2021-02-02
}

i'm having a problem using a query to find a data with a request date exists and validate date null.我在使用查询查找具有请求日期的数据并验证日期 null 时遇到问题。

i tried following query, but it returns all null我尝试了以下查询,但它返回所有 null

db.testing.find({"date.validate" : {$exists:false} })

is there any condition that i can use to manipulate data like有什么条件可以用来操作数据,比如

SELECT * FROM testing WHERE request is not null and validate is null

Thanks谢谢

For request date exists & validate date null:对于请求日期存在和验证日期 null:

db.testing.find({"date.validate" : null, "date.request" : {
        $exists : true 
    }   })

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM