I am trying to use the wildcard operator found here: https://docs.atlas.mongodb.com/reference/atlas-search/wildcard/ but whenever I try to run it, I get the following error:
MongoError: Unrecognized pipeline stage name: ‘$search’
My documents are like this:
{
"_id": {
"$oid": "609de83a3495584e98327521"
},
"email": "test.person@example.com",
"name": "test middlename person",
"ip": "192.168.0.1",
"hash": "af1bd74f67760edbb1df27f8af09d4267a8d3309178c6b95523ec757fe1d81d6",
"twitter": "",
"facebook": "",
"userid": "wef23f23fwefwwfhgeyukjykuyk"
}
I am trying to run the following wildcard query:
db.whatever.aggregate([
{
"$search": {
"wildcard": {
"path": "email",
"query": "test.pe*"
}
}
}
])
My mongodb is version 4.4.6 Community edition.
Please let me know why the query is not working.