What is the correct way of using Bluebird for Mongoose promises?
<p>I've been reading documentaion and articles and everyone seems to describe a different way about using Mongoose and Bluebird together. Even the official Mongoose documentation <a href="http://mongoosejs.com/docs/promises.html" rel="noreferrer">says something</a> and Bluebird documentaion says <a href="http://bluebirdjs.com/docs/api/promisification.html" rel="noreferrer">another thing</a>.</p>

<p>According to Mongoose:</p>

<pre class="lang-js prettyprint-override"><code>mongoose.Promise = require('bluebird');
</code></pre>

<p>According to Bluebird:</p>

<pre class="lang-js prettyprint-override"><code>var Promise = require("bluebird");
Promise.promisifyAll(require("mongoose"));
</code></pre>

<p>So to my understanding, if you pick the Mongoose way a sample query would be like:</p>

<pre class="lang-js prettyprint-override"><code>User.findById('someId')
    .then(function(){
        // do stuff
    })
    .catch(function(err){
        // handle error
    })
</code></pre>

<p>But also in Mongoose docs it says that:</p>

<blockquote>
  <p>Mongoose queries are not promises. However, they do have a .then() function for yield and async/await. If you need a fully-fledged promise, use the .exec() function.</p>
</blockquote>

<p>So in this case, is <code>.then</code> above a promise or not?</p>

<p>If you go with Bluebird way:</p>

<pre class="lang-js prettyprint-override"><code>User.findById('someId')
    .execAsync()
    .then(function(){
        // do stuff
    })
    .catch(function(err){
        // handle error
    })
</code></pre>

<p>Or maybe even skip <code>execAsync()</code> and start with <code>findByIdAsync</code> instead.</p>

<p>Really confused with different documentaion. I'd appreciate if someone can shed some light into this.</p>