We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent da77b8d commit c5b2355Copy full SHA for c5b2355
test/docs/promises.test.js
@@ -84,6 +84,21 @@ describe('promises docs', function () {
84
});
85
86
87
+ /**
88
+ * Although queries are not promises, queries are [thenables](https://promisesaplus.com/#terminology).
89
+ * That means they have a `.then()` function, so you can use queries as promises with either
90
+ * promise chaining or [async await](https://asyncawait.net)
91
+ */
92
+ it('Queries are thenable', function (done) {
93
+ Band.findOne({name: "Guns N' Roses"}).then(function(doc) {
94
+ // use doc
95
+ // acquit:ignore:start
96
+ assert.ok(!doc);
97
+ done();
98
+ // acquit:ignore:end
99
+ });
100
101
+
102
/**
103
* If you're an advanced user, you may want to plug in your own promise
104
* library like [bluebird](https://www.npmjs.com/package/bluebird). Just set
0 commit comments