I've been using mongooses promises recently, and they're really great. I'm writing code that can take a Query object or a Promise object and resolve them accordingly. That code uses
if (item instanceOf Query) {..}
else {...}
to discern between the two.
However, it seems as if mongoose's promises are returning true for the instance query. I'm using 3.8.0 but upgrading to 3.8.4 gives the same result. Here's an example of a promise I'm building
var p = this.find(cond).sort('endDate').populate('_artist').exec().then(ƒ(docs) {
return Model.populate(docs, {path: 'pathName'})
})
console.log(p instanceof Query) //logs true
console.log(p instanceof Promise) //logs false
This seems incorrect to me. Am I doing anything wrong?