Skip to content
JerrySievert edited this page Sep 29, 2014 · 3 revisions

Query Parsing

Simple Equality

WHERE foo = 'bar'

{
  operand: "equals",
  key: "foo",
  value: "bar"
}

And/Or

WHERE (name = 'Main' OR crime.type = 'Arson') AND date BETWEEN '2013-11-30' AND '2014-01-01'

{
  operand: "$and",
  value: [
    {
      operand: "$or",
      value: [
        {
          operand: "equals",
          key: "name",
          value: "Main"
        },
        {
          operand: "equals",
          key: "crime.type",
          value: "Arson"
        }
      ]
    },
    {
      operand: "between",
      key: "date",
      value: [ '2013-11-30', '2014-01-01' ]
    }
  ]
}

Order

WHERE foo = 'bar' ORDER BY date DESC, author

{
  order: [
    "-date",
    "author"
  ],
  operand: "equals",
  key: "foo",
  value: "bar"
}

Limit

WHERE foo = 'bar' LIMIT 10

{
  limit: 10,
  operand: "equals",
  key: "foo",
  value: "bar"
}

Clone this wiki locally