tshelburne / mongodm

A basic Node ODM for Mongo to start up simple projects
3 stars 0 forks source link

Async integration #6

Open tshelburne opened 9 years ago

tshelburne commented 9 years ago

When used with async, it's a bit inconvenient to use the mappers as opposed to the Constructors for loading. For instance:

async.parallel([ db.articles.all.bind(db.articles), db.projects.all.bind(db.projects), ... ]), function(err, results) {
    if (err) next(err);

    ... // whatever
});

Whereas with constructors:

async.parallel([ Article.all, Project.all, ... ]), function(err, results) {
    if (err) next(err);

    ... // whatever
});