Skip to content

Commit

Permalink
Merge pull request #46 from mongoist/remove-unnecessary-await
Browse files Browse the repository at this point in the history
test: remove unnecessary await
  • Loading branch information
skeggse committed Mar 30, 2020
2 parents a4b53cc + 3a65f38 commit 919d2c3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions README.md
Expand Up @@ -114,6 +114,12 @@ db.collection('foo').find(...);
// find everything in mycollection returned as array
const documents = await db.mycollection.find();

// find everything in mycollection returned as a Cursor (no intermediate Promise)
const documentsCursor = db.mycollection.findAsCursor();

// take the first document from the cursor
const document = await documentsCursor.next();

// find everything in mycollection, but sort by name
const sortedDocuments = await db.mycollection.findAsCursor().sort({name: 1}).toArray();

Expand Down
4 changes: 2 additions & 2 deletions test/database.js
Expand Up @@ -265,7 +265,7 @@ describe('database', function() {
expect(docs).to.deep.contain({ name: 'Charmander' });
expect(docs).to.deep.contain({ name: 'Lapras' });

const cursor = await db.a.findAsCursor({}, { name: true, _id: false });
const cursor = db.a.findAsCursor({}, { name: true, _id: false });

const doc = await cursor.next();

Expand Down Expand Up @@ -300,7 +300,7 @@ describe('database', function() {
expect(docs).to.deep.contain({ name: 'Charmander' });
expect(docs).to.deep.contain({ name: 'Lapras' });

const cursor = await db.a.findAsCursor({}, { name: true, _id: false });
const cursor = db.a.findAsCursor({}, { name: true, _id: false });

const doc = await cursor.next();

Expand Down

0 comments on commit 919d2c3

Please sign in to comment.