Skip to content

Commit c001d07

Browse files
authored
docs(NODE-3271): add versioned api examples (#2877)
1 parent fe71106 commit c001d07

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
'use strict';
2+
const { MongoClient } = require('../../../src');
3+
4+
describe('examples.versionedApi:', function () {
5+
let uri;
6+
// eslint-disable-next-line no-unused-vars
7+
let client;
8+
before(function () {
9+
uri = this.configuration.url();
10+
});
11+
12+
it('declare an API version on a client', function () {
13+
// Start Versioned API Example 1
14+
15+
client = new MongoClient(uri, { serverApi: { version: '1' } });
16+
17+
// End Versioned API Example 1
18+
});
19+
20+
it('declare an API version on a client with strict enabled', function () {
21+
// Start Versioned API Example 2
22+
23+
client = new MongoClient(uri, { serverApi: { version: '1', strict: true } });
24+
25+
// End Versioned API Example 2
26+
});
27+
28+
it('declare an API version on a client with strict disabled', function () {
29+
// Start Versioned API Example 3
30+
31+
client = new MongoClient(uri, { serverApi: { version: '1', strict: false } });
32+
33+
// End Versioned API Example 3
34+
});
35+
36+
it('declare an API version on a client with deprecation errors enabled', function () {
37+
// Start Versioned API Example 4
38+
39+
client = new MongoClient(uri, { serverApi: { version: '1', deprecationErrors: true } });
40+
41+
// End Versioned API Example 4
42+
});
43+
});

0 commit comments

Comments
 (0)