Each driver typically has its own way of dealing with query constraints. A example of a constraint would be f1 < 2 and f2 >= 3. Since the data handler uses a query by example syntax, it's not immediately obvious how to apply multiple constraints. The data handler provides a mechanism for specific handlers to filter results, even if the handler itself is not capable of these operations - meaning that the syntax is exactly the same regardless of how the underlying driver works.
The handler provides a method, .constraint() that can apply constraints to a query by example. Consider this query -
which would return all objects matching the example.
But say we wanted all heights between .5 and .9 , and all ages less than 7.
This is similar to the ScriptDB and parse.com approach, except of course using the data handler means that the syntax is now the same for all drivers.
Trying to represent multi depth objects in a 2 dimensional space, such as a spreadsheet can be a challenge. The approach I'm using is laid out in Flattening and unflattening objects to spreadsheets. This means that we can use dot syntax to define queries going beyond 1 level.
Thus this query
can also be represented as
Combining dot syntax and constraints
This is also possible, as below
Drivers that cannot implement these functions natively, can use the DataHandler method below to filter down their results. In any case, drivers should be able to deal with a queryOb that may need flattening or have constraints.
See Database abstraction with google apps script for more on this.
Services > Desktop Liberation - the definitive resource for Google Apps Script and Microsoft Office automation > Database abstraction and Google Apps Script >