Query Language

Query Language

Since dobo use Ghost QL for its query language, you have the option to pick one of these syntaxes:

Any NQL statements will be converted to MongoDB-like QL object first, this then passed down to the database's native QL provided by its driver.

Examples from NQL test suite:

Equals

count:5

{ count: 5 }

slug:getting-started

{ slug: 'getting-started' }

author:'Joe Bloggs'

{ author: 'Joe Bloggs' }

Not Equals

count:-5

{ count: { $ne: 5 } }

author:-'Joe Bloggs'

{ author: { $ne: 'Joe Bloggs' } }

Less/Greater Than or Equals

count:>5

{ count: { $gt: 5 } }

tag:<getting-started

{ tag: { $lt: 'getting-started' } }

count:>=5

{ count: { $gte: 5 } }

author:<='Joe Bloggs'

{ author: { $lte: 'Joe Bloggs' } }

IN or NOT IN, single or multiple value

count:[5]

{ count: { $in: [5] } }

tag:-[getting-started]

{ tag: { $nin: ['getting-started'] } }

author:-['Joe Bloggs', 'John O\'Nolan', 'Hello World']

{ author: { $nin: ['Joe Bloggs', 'John O\'Nolan', 'Hello World'] } }

CONTAINS, STARTSWITH and ENDSWITH with and without NOT

email:~'gmail.com'

{ email: { $regex: /gmail\.com/i } }

email:-~'gmail.com'

{ email: { $not: /gmail\.com/i } }

email:~^'gmail.com'

{ email: { $regex: /^gmail\.com/i } }

email:-~^'gmail.com'

{ email: { $not: /^gmail\.com/i } }

email:~$'gmail.com'

{ email: { $regex: /gmail\.com$/i } }

email:-~$'gmail.com'

{ email: { $not: /gmail\.com$/i } }

NULL and Boolean Value

image:null

{ image: null }

featured:false

{ featured: false } }

featured:-true

{ featured: { $ne: true } }

Logical Operators

page:false+status:published

{ $and: [{ page: false }, { status: 'published' }] }

page:true,featured:true

{ $or: [{ page: true }, { featured: true }] }

Groups/ungroups

(page:false,(status:published+featured:true))

{
  $or: [
    { page: false },
    {
      $and: [
          {status: 'published'},
          {featured: true}
      ]
    }
  ]
}