I am trying to implement a autocomplete search in golang but I keep getting an error with the syntax
contactsCollection := c.DB.Database("XYZ").Collection("contacts")
result, err := contactsCollection.aggregate([{
"$search": {
"autocomplete": {
"query": searchQuery,
"path": "email",
"tokenOrder": "any"
}
}
}
])
searchQuery is the input coming in and email is the field upon which I want to do the autocomplete. I am assuming that I would be able to return result.
What am I missing here?