robertcampion / dredd

Scoring software for the MRDC (Midwestern Robotics Design Competition)
1 stars 0 forks source link

Use native promises with Mongoose #3

Closed robertcampion closed 8 years ago

robertcampion commented 8 years ago

Currently when requireing Mongoose, we use code like:

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.

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.

mongoose.Promise = global.Promise;