Hi.
On a QUERY service I use the following query string:
{ $text: { $search: "Coffee" } }
As per screenshot below. There are 2 indexed columns in the database.
Can anyone help me with this one? Is my syntax wrong?
Hello Juan,
Please look at this documentation page: https://devcenter.appery.io/documenta...
Hi thanks. So, I assume indexed searches are out?
I can use a regex search, but I'll need a little help.
In my collection, I've got 2 columns, ColA and ColB (both are text columns)
I have 3 'keywords' e.g. "Coffee", "Tea" and "Ice".
I would like to do a query on the collection and have it return a result of all records where any (or both) of the columns contain any (or all) of the keywords.
Not sure what the regex query for this will look like.
Thanks ![]()
Ok, thanks.. In that case (no indexed search) please see my follow-up question below. ![]()
In this way you have to use "$or" parameter: https://devcenter.appery.io/documenta...
Ah thanks. What is the regex syntax to check for a string containing a substring.
StringA = "Coffee"
StringB = "The Coffee shop"
so basically a regex that will return 'true' when searching for the string "Coffee" in stringB.
Cheers
Please use simple strings for that:
{"$regex": "Coffee"}
and
{"$regex": "The Coffee shop"}
Hi There, it's about indexing a field in collection.
after creating the new collection
I inserted 2 columns. one of them I wanted it indexed, therefore I went to the "Index Manager" tab.
so far all fine.
then, comes my question: in my serverCode, shall I call that index again ?
I tried using
db.collection.ensureIndex({'columnName':1});
but got error msg cannot find undefined ... which means it does find the columnName ...
I m not to use this code if not necessary since the index is declared already.
what to do to make it effective ?
thks in advance,
Eric
Hello,
Please clarify, where did you found that code? What are you trying to do?
Hi Sergiy, I got that one there https://docs.mongodb.com/manual/refer...
maybe not necessary, since the indexed field does exist in the "manage index" tab ?
tell me,
best,
Eric