We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
mongoosejs
Learn more about funding links in repositories.
Report abuse
1 parent 8cccafb commit 6ff39efCopy full SHA for 6ff39ef
lib/query.js
@@ -2134,6 +2134,20 @@ Query.prototype.exec = function exec(op, callback) {
2134
});
2135
};
2136
2137
+/**
2138
+ * Executes the query returning a `Promise` which will be
2139
+ * resolved with either the doc(s) or rejected with the error.
2140
+ *
2141
+ * @param {Function} [resolve]
2142
+ * @param {Function} [reject]
2143
+ * @return {Promise}
2144
+ * @api public
2145
+ */
2146
+
2147
+Query.prototype.then = function(resolve, reject) {
2148
+ return this.exec().then(resolve, reject);
2149
+}
2150
2151
/**
2152
* Finds the schema for `path`. This is different than
2153
* calling `schema.path` as it also resolves paths with
0 commit comments