As you know, we have 3 types of facets
: string
, number
, and date
facets.
Well, I want my facest for 2 fields in my document, src_n
which is a string, and src_oid
which is ObjectId
.
How can I apply a facet since it is an object, not a number or string? Any idea to deal with it, please?
results_2 = list(
my_collection.aggregate(
[
{
"$searchMeta": {
"index": "TextIndex",
"facet": {
"facets": {
"src_n": {
"type": "string",
"path": "src_n",
"numBuckets": 1000,
},
"src_oid": {
"type": ObjectId,
"path": "src_oid",
"numBuckets": 1000,
},
},
},
},
},
]
)
)