Skip to content

Commit

Permalink
docs(NODE-3406): add versioned api examples (#2969)
Browse files Browse the repository at this point in the history
  • Loading branch information
emadum committed Aug 31, 2021
1 parent a07aa56 commit 7602f68
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions test/examples/versioned_api.js
@@ -0,0 +1,43 @@
'use strict';
const MongoClient = require('../..').MongoClient;

describe('examples.versionedApi:', function() {
let uri;
// eslint-disable-next-line no-unused-vars
let client;
before(function() {
uri = this.configuration.url();
});

it('declare an API version on a client', function() {
// Start Versioned API Example 1

client = new MongoClient(uri, { serverApi: { version: '1' } });

// End Versioned API Example 1
});

it('declare an API version on a client with strict enabled', function() {
// Start Versioned API Example 2

client = new MongoClient(uri, { serverApi: { version: '1', strict: true } });

// End Versioned API Example 2
});

it('declare an API version on a client with strict disabled', function() {
// Start Versioned API Example 3

client = new MongoClient(uri, { serverApi: { version: '1', strict: false } });

// End Versioned API Example 3
});

it('declare an API version on a client with deprecation errors enabled', function() {
// Start Versioned API Example 4

client = new MongoClient(uri, { serverApi: { version: '1', deprecationErrors: true } });

// End Versioned API Example 4
});
});

0 comments on commit 7602f68

Please sign in to comment.