Closed robertcampion closed 8 years ago
Currently when requireing Mongoose, we use code like:
require
var mongoose = require('bluebird').promisifyAll(require('mongoose'));
This creates duplicates of all the methods of mongoose, e.g. mongoose.Schema.find is duplicated as mongoose.Schema.findAsync.
mongoose
mongoose.Schema.find
mongoose.Schema.findAsync
However, mongoose already has support for promises. The previous example should instead look like mongoose.Schema.find(args).exec()
mongoose.Schema.find(args).exec()
We should change existing code to use the latter style to eliminate the dependency on bluebird.
I'll also look into using native promises (instead of Mongoose's default of mpromise) with e.g.
mongoose.Promise = global.Promise;
Currently when
require
ing Mongoose, we use code like:This creates duplicates of all the methods of
mongoose
, e.g.mongoose.Schema.find
is duplicated asmongoose.Schema.findAsync
.However, mongoose already has support for promises. The previous example should instead look like
mongoose.Schema.find(args).exec()
We should change existing code to use the latter style to eliminate the dependency on bluebird.
I'll also look into using native promises (instead of Mongoose's default of mpromise) with e.g.