prepareFind #9

Closed
pmlopes opened this Issue Nov 12, 2012 · 0 comments

1 participant

@pmlopes
Owner

Rationale:

In order to reduce the amount of indentation all models should have a prepare find functions that returns an object that can be used to query the database.

The idea is to create several of these objects and then ask to ODM to query them in parallel e.g.:

var f1 = modelA.prepareFind({});
var f2 = modelB.prepareFind({});

odm.find({f1: f1, f2: fe}, function (err, resultSet) {
resultSet.f1...
resultSet.f2...
});

API:

Model.prepareFind(query, options, fields)
Model.prepareFindAll(query, options, fields)
Model.prepareFindOne(query, options, fields)
Model.prepareFindById(query, options, fields)

internally the find object would be something like:
{key: String, find: {model: Model, multi: Boolean, query: Object, options: Object, fields: Object}}

@pmlopes pmlopes was assigned Nov 12, 2012
@pmlopes pmlopes pushed a commit that referenced this issue Nov 12, 2012
Paulo Lopes #9 parallel finders fa9899e
@pmlopes pmlopes closed this Nov 12, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment