Hi, I was trying to query an atlas search Index. The datatype is objectId and the index contains other paths which has autocomplete datatype. When I try to query the index using equals operator for the path that has objectId datatype, nothing is being returned. The Index definition is as follows
{
"mappings": {
"dynamic": false,
"fields": {
"hscode": {
"foldDiacritics": true,
"maxGrams": 4,
"minGrams": 1,
"tokenization": "edgeGram",
"type": "autocomplete"
},
"title": {
"foldDiacritics": true,
"maxGrams": 10,
"minGrams": 2,
"tokenization": "edgeGram",
"type": "autocomplete"
},
"type._id": {
"type": "objectId"
}
}
}
}
The query details are as follows
db.categories.aggregate([
{
$search:{
index:"categorySearch",
equals:{
path:"type._id",
value:ObjectId("61711b4275e9397ec79bdfed")
}
}
}
])
Note : The autocomplete queries are working without a problem