Skip to content

Commit b7b2b0b

Browse files
committed
docs(test-runners): update mocha example code for mongoose 5+
1 parent 1310d6b commit b7b2b0b

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

docs/guides/integration-examples/test-runners.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,11 @@ import mongoose from 'mongoose';
114114
import { MongoMemoryServer } from 'mongodb-memory-server';
115115

116116
let mongoServer;
117-
const opts = { useMongoClient: true }; // remove this option if you use mongoose 5 and above
118117

119118
before(async () => {
120119
mongoServer = await MongoMemoryServer.create();
121120
const mongoUri = mongoServer.getUri();
122-
await mongoose.connect(mongoUri, opts);
121+
await mongoose.connect(mongoUri);
123122
});
124123

125124
after(async () => {
@@ -130,7 +129,7 @@ after(async () => {
130129
describe('...', () => {
131130
it('...', async () => {
132131
const User = mongoose.model('User', new mongoose.Schema({ name: String }));
133-
const cnt = await User.count();
132+
const cnt = await User.countDocuments();
134133
expect(cnt).to.equal(0);
135134
});
136135
});

0 commit comments

Comments
 (0)