Skip to content

Commit

Permalink
Merge pull request #18 from Ben305/support-mongoose-5
Browse files Browse the repository at this point in the history
Support mongoose 5.0.x
  • Loading branch information
drudge authored Feb 28, 2018
2 parents 06af724 + b3bb08f commit 17d6cbd
Show file tree
Hide file tree
Showing 5 changed files with 401 additions and 27 deletions.
4 changes: 1 addition & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
language: "node_js"
node_js:
- "8"
- "7"
- "6"
- "5"
- "4"
- 'iojs'
- '0.12'
- "0.10"
services:
- mongodb
3 changes: 2 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
function findOrCreatePlugin(schema, options) {
schema.statics.findOrCreate = function findOrCreate(conditions, doc, options, callback) {
var self = this;
var Promise = self.base.Promise.ES6;
// When using Mongoose 5.0.x and upper, we must use self.base.Promise
var Promise = self.base.Promise.ES6 ? self.base.Promise.ES6 : self.base.Promise;
if (arguments.length < 4) {
if (typeof options === 'function') {
// Scenario: findOrCreate(conditions, doc, callback)
Expand Down
368 changes: 368 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 17d6cbd

Please sign in to comment.