Nitric logo

Collections

collection.query.where()

Adds a new where clause to a query, which filters the data returned.

from nitric.resources import collection

profiles = collection('profiles').allow('reading')

query = collection("profiles").query().where("name", startsWith, 'T')

Parameters


field required string

The document field to query


operation required string

The query operation to perform

Valid values are: startsWith | == | != | >= | <= | > | <


value required string or number

The value to compare against


Notes

Where clauses combined together are always considered AND

Examples

A simple query

from nitric.resources import collection

profiles = collection('profiles').allow('reading')

query = profiles.query().where("firstName", '==', 'Drake')

Combining where clauses

from nitric.resources import collection

profiles = collection('profiles').allow('reading')

query = profiles.query().where("firstName", '==', 'Drake').where('age', '>=', 21)

See also

Previous
collection.query()