1

我是 MongoDB 索引的新手,想知道为以下查询创建索引是否有意义。

{
        $and: [
            {_id: {$ne: "SOME_ID"}},
            {_id: {$nin: ["ID1","ID2","ID3"]}},
            {_id: {$nin: ["ID4","ID5","ID6"]}}
        ],
        age: {$gte: 18, $lte: 50},
        gender: "male",
        location: {
            $nearSphere: {
                $geometry: {
                    type: "Point",
                    coordinates: ["some_valid_longitude", "some_valid_latitude"]
                },
                $maxDistance: 1000
            }
        },
        work: "work",
        registrationComplete: true
}

是否需要上述查询的索引?以及如何创建它?索引会影响写入速度吗?

4

0 回答 0