|
Currently only find queries addressing a complete entity can expressed via native queries for MongoDB. One can not express projections nor insert or other update queries. As there is no canonical string-based query language in MongoDB, one way of achieving this is to allow for queries to be given as invocations of (a subset of) the MongoDB JavaScript API:
db.Order.find({name : "lunar vehicle"})
db.Order.find({name : "lunar vehicle"}, { name : 1, price : 1})
db.Order.insert({name : "lunar vehicle", price : 300})
A very simple sub-set of what's actually possible with the API would suffice, as most things can be expressed either as API call (e.g. sort()) or via special fields in the query object (e.g. "$orderby"). So we can start simple and evolve from there.
|