Page 1 of 1

$not where clause

Posted: Mon Mar 09, 2015 3:48 pm
by Joe Sharples

how do i use the $not where comparison value?

http://devcenter.appery.io/documentat...

I have a database service and i want all the rows to be returned that don't have "Open" as the text in the 'NightName' Field.

I have tried
{"NightName": {"$not":"Open"}}

but this returned:
pre
{
"status":400,
"uri":"https://api.appery.io/rest/1/db/collections/Nights",
"response":{
"code":"DBSQ271",
"description":"Mongo error: error code is '17287'"
}
}/pre


$not where clause

Posted: Mon Mar 09, 2015 5:49 pm
by Egor Kotov6832188

Hello Joe.

Here is an example

{"Name":{"$not":{"$regex": "name"}}}
where
Name - collumn name
name - value I'm not looking for


$not where clause

Posted: Mon Mar 09, 2015 7:33 pm
by Joe Sharples

Hi Egor,

This almost worked.
I dont want to return the row with the exact text "Open" in the 'NightName'.

I have a few rows with the 'NightName' "Open mic night".

your code removed this row.
its only rows with the exact text "Open" that I dont want it to return.


$not where clause

Posted: Wed Mar 11, 2015 6:57 pm
by Joe Sharples

How would i write the code so that it doesnt return results with the exact text "Open", so that it will still let results with the text "Open mic night" pass through?


$not where clause

Posted: Fri Mar 13, 2015 2:44 am
by Yurii Orishchuk

Hi Joe,

Please try following:

pre

{"Name":{"$not":{"$regex": "Open$"}}}

/pre

Regards.