0

这是 mongodb 中的查询,我曾经根据状态、verify_status 及其类别以及它们的位置来获取信息,它们只是该字段的一个位置,但需要在多个位置集中查找。

更新:我尝试在 Robo3t 中运行此查询,它返回空白结果,但我在 Studio3t 中运行的相同查询显示预期结果。有没有版本问题。

{
    "status":{
        "$eq":"Active"
    },
    "verify_status":{
        "$eq":"Yes"
    },
    "$or":[
    {
        "category":{
            "$eq":{
                "$oid": "5da0f71e15712b5f7723bb58"
            }
        }
    },
    {
        "multi_car_status":{

            "$eq":"ON"

        },
        "additional_category":{

            "$eq": "5da0f71e15712b5f7723bb58"

        }
    }
    ],
    "driver_location":{
        "$in":[
            "5dee787f15712b443f6a5e06",

            "5dee787f15712b443f6a5e06"
        ]
    }
}

当我删除 driver_location 或“$ or”时,它的返回结果在 db 中有结果,但它返回返回 0 结果。我无法得到这两个运算符的结果。以下是样本数据。

{
    "_id" : ObjectId("5ead0f5f15712b5df22d7e23"),

    "driver_location" : "5dee787f15712b443f6a5e06",

    "category" : ObjectId("5da0f71e15712b5f7723bb58"),

    "image" : "7f8e1ddfbe862a7ac4386b2f41fe953f.jpg",

    "driver_name" : "Ravi aa",

    "email" : "#####@gmail.com",

    "dail_code" : "+1",

    "mobile_number" : "83748746",

    "dob" : "10/05/2000",

    "password" : "######",

    "verify_status" : "Yes",

    "status" : "Active",

    "availability" : "Yes",

    "mode" : "Available",

    "gender" : "male",

    "vehicle_type" : null,

    "vehicle_maker" : "5da0f05115712b5fb36e3d02",

    "vehicle_model" : "5db22e1215712b25a36b8a3c",
   
   
    "loc" : {
        "lon" : 77.35124777,
        "lat" : 28.6543715
    },
    "address" : {
        "address" : "delhi",
        "county" : "United States",
        "state" : "AR",
        "city" : "delhi",
        "postal_code" : "122001"
    },
    "multi_car_status" : "ON",
    "additional_category" : [ 
        "5da09ed315712b413333ca58",
 
        "5da0f6fc15712b5c1956eed6", 

        "5da0f73b15712b5fb36e3d09"
    ],
   
   
}
4

0 回答 0