I'm newbie to MongoDB Atlas. I want to execute a query as below,
Sample document:
{ message: "Hello", role: "student", status: 1 }
Query
search WHERE 'Hello' in field 'message' NOT [1 OR 2] in field 'status'
I tried with compound
and search
as below, but couldn't get what I want.
compound:{ must:[{ text: { query: 'Hello', path: 'message' } }], mustNot:[ { text: { query: 1, path: 'status' } }, { text: { query: 2, path: 'status' } } ] }
This returns an error saying,
"Query" must be a string (from "compund.mustNot[2].text").
And when I make those as String it doesn't return any values. I understand that I'm using a text search here, but I couldn't find any other alternatives. Is it not possible to search int values in MongoDB Atlas?
https://stackoverflow.com/questions/65767870/how-number-value-search-in-mongodb-atlas-work January 18, 2021 at 09:53AM
没有评论:
发表评论