forked from TryGhost/GQL
-
Notifications
You must be signed in to change notification settings - Fork 0
Negation
Laran Evans edited this page Mar 27, 2016
·
1 revision
| GQL | JSON | SQL |
|---|---|---|
! |
{$not: <condition>} |
NOT |
All comparison operators can be negated.
Negate in GQL using ! before the property (e.g. !title:Foo means NOT title = 'Foo').
Always remember that the ! goes before the property and not the value.
Negate in JSON using $not (e.g. {$not: {title: 'Foo'}}).
Entire Clauses can be negated using the same syntax.
For example:
| GQL | JSON | SQL |
|---|---|---|
!(created_at:>=\'2015-01-01\'+created_at:<\'2016-01-01\') |
{$not: [{created_at: {$gte: '2015-01-01'}}, {created_at: {$lt: '2016-01-01'}}]} |
NOT (created_at >= '2015-01-01' AND created_at < '2016-01-01') |