mongodb 3.6.0 → 3.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/HISTORY.md CHANGED
@@ -1,93 +1,22 @@
1
- # Changelog
1
+ # Change Log
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
- ## [3.6.0](https://github.com/mongodb/node-mongodb-native/compare/v3.5.7...v3.6.0) (2020-07-30)
6
-
7
-
8
- ### Features
9
-
10
- * add commitQuorum option to createIndexes command ([38bcaf7](https://github.com/mongodb/node-mongodb-native/commit/38bcaf7c80f63885d4c0cf1f7389819efb0664e6))
11
- * introduce an interruptable async interval timer ([1e4e837](https://github.com/mongodb/node-mongodb-native/commit/1e4e8373308a6d99c4d7eda4ae395f8293de98eb))
12
- * support streaming ismaster responses ([f6629d9](https://github.com/mongodb/node-mongodb-native/commit/f6629d9946d6d02012a6f1f7848306bc71fb3254))
13
- * **reIndex:** deprecate and make standalone-only command ([3a53b3d](https://github.com/mongodb/node-mongodb-native/commit/3a53b3deb7b375f6ce1e1a7435706aa4df7b0a0c))
14
- * add helper to run async collection in series ([f762532](https://github.com/mongodb/node-mongodb-native/commit/f76253242a9b9c3d1fc5be215e8b677af2138772))
15
- * allow hinting the delete command ([84cf955](https://github.com/mongodb/node-mongodb-native/commit/84cf95519d55e478b6457ba2347daf448388caf2))
16
- * consider staleness and topologyVersion in error handling ([018e6ed](https://github.com/mongodb/node-mongodb-native/commit/018e6edc923f1bb7aa13bf376edd71172bfc5039))
17
- * introduce `MongoNetworkTimeoutError` ([c1e4477](https://github.com/mongodb/node-mongodb-native/commit/c1e44777f9ede629290bb776c420018a4acdc487))
18
- * support checking if network error happened before handshake ([5411786](https://github.com/mongodb/node-mongodb-native/commit/541178690d558a4484d43d2a090d0b4d5416c031))
19
- * support hedged reads ([37cd5ee](https://github.com/mongodb/node-mongodb-native/commit/37cd5eed9f872429f3d0f683ed92cc75231d4685))
20
- * support speculative authentication in scram-sha and x509 ([6231164](https://github.com/mongodb/node-mongodb-native/commit/62311645c5e9a44678e4a997b6a5944b64492bd8))
21
- * **geoHaystackSearch:** deprecate geoHaystackSearch ([3f6786b](https://github.com/mongodb/node-mongodb-native/commit/3f6786b4c00d0650eb9c8009507e9c54b2b11bbc))
22
- * **sdam:** ignore stale topology updates ([f87d243](https://github.com/mongodb/node-mongodb-native/commit/f87d243587c1712cd95624d036ddb9a643a15a84))
5
+ <a name="3.6.1"></a>
6
+ ## [3.6.1](https://github.com/mongodb/node-mongodb-native/compare/v3.6.0...v3.6.1) (2020-09-02)
23
7
 
24
8
 
25
9
  ### Bug Fixes
26
10
 
27
- * `resolveAuthMechanism` should not mutate credentials ([be19a21](https://github.com/mongodb/node-mongodb-native/commit/be19a2160d33d8e7473800fbcf6af1cd7f6eaeef))
28
- * always clear cancelled wait queue members during processing ([3087d48](https://github.com/mongodb/node-mongodb-native/commit/3087d48c5de17dcd77d48b35af591a8f6780d145))
29
- * always include `writeErrors` on a `BulkWriteError` instance ([40db47f](https://github.com/mongodb/node-mongodb-native/commit/40db47f5aac1e93a11e8568327e93c4c542e11da))
30
- * assert update/replace atomic requirements in bulk operations ([31ae3c9](https://github.com/mongodb/node-mongodb-native/commit/31ae3c9978d6ea4f33c3ea4ccac9cd41841e31de))
31
- * clarify handle wrong set name single topology ([21424eb](https://github.com/mongodb/node-mongodb-native/commit/21424ebb961db339be8fa74babaaeb3ada8e22c8))
32
- * createCollection only uses listCollections in strict mode ([a8ffec4](https://github.com/mongodb/node-mongodb-native/commit/a8ffec4c0b4e2ef0ce4c3bcdadc0adeccd0a3544))
33
- * db.command to not inherit options from parent ([c394284](https://github.com/mongodb/node-mongodb-native/commit/c39428421c94b4a1c5f41340e5b1a82724af95bd))
34
- * don't create multiple rtt pingers if one already exists ([56723aa](https://github.com/mongodb/node-mongodb-native/commit/56723aa1c980894ededd97531ff023a603cf4271))
35
- * don't immediately schedule monitoring after streaming failure ([188c23e](https://github.com/mongodb/node-mongodb-native/commit/188c23e0bb173a032df6bea4c7d2a916b808d9ad))
36
- * don't reapply socket timeout when socket has `moreToCome` ([ca0f2b9](https://github.com/mongodb/node-mongodb-native/commit/ca0f2b9d3fc268187d112e3afbe7bc556273e100))
37
- * don't try to calculate sMax if there are no viable servers ([4cb9b64](https://github.com/mongodb/node-mongodb-native/commit/4cb9b64bc3ff9aed8f26091cfe52acb152146898))
38
- * ensure implicit sessions are ended consistently ([8c861f3](https://github.com/mongodb/node-mongodb-native/commit/8c861f3e6c743a65ee95c8036ee0c1b1bc8c427a))
39
- * filter servers before applying reducers ([6f7d9bf](https://github.com/mongodb/node-mongodb-native/commit/6f7d9bf7f03108af3d190965a8b536ec2fb68a0b))
40
- * hint should raise error on unacknowledged writes ([54aa19e](https://github.com/mongodb/node-mongodb-native/commit/54aa19ea10a18ee6fce93f7c7eb6562c9f4042a5))
41
- * honor journal=true in connection string ([#2358](https://github.com/mongodb/node-mongodb-native/issues/2358)) ([4df4b7c](https://github.com/mongodb/node-mongodb-native/commit/4df4b7c3133925432954ce249c8bf8ae34674cb9))
42
- * IPv6 is not supported when using dns service discovery ([19ec62f](https://github.com/mongodb/node-mongodb-native/commit/19ec62fad5912b5e1f615278a4c2fba153da5030))
43
- * linting issue ([babf845](https://github.com/mongodb/node-mongodb-native/commit/babf84517675240c5ca39631c771e04ba9e248d7))
44
- * MONGODB-AWS temporary credentials are added to authContext ([769a754](https://github.com/mongodb/node-mongodb-native/commit/769a75491ede69a6af8da8f2d6572c6c85e14a62))
45
- * ReadPreference maxStalenessSeconds from options ([dfe7afa](https://github.com/mongodb/node-mongodb-native/commit/dfe7afaf646b2cde1751e728b52fa40d672beb55))
46
- * reduce default keepalive time to align with Azure defaults ([72d8969](https://github.com/mongodb/node-mongodb-native/commit/72d896983ed70fd0f96dea3a37ff05a5d91a93ba))
47
- * remove destructuring assignments for legacy node support ([d728a13](https://github.com/mongodb/node-mongodb-native/commit/d728a1330a37e847b69937b42e179c58b47038cb))
48
- * silently ignore session with unacknowledged write ([a053f4e](https://github.com/mongodb/node-mongodb-native/commit/a053f4ea3f5ad1c8c8a581c449cf03dc252aeb06))
49
- * **ChangeStream:** handle null changes ([14179a2](https://github.com/mongodb/node-mongodb-native/commit/14179a270ce4bfa62884ee53d46f4e35d28b6100))
50
- * **ChangeStream:** make CursorNotFound error resumable ([9f0b7ab](https://github.com/mongodb/node-mongodb-native/commit/9f0b7ab65a5d443f411a61fa1a3dd6cfe42b8dce))
51
- * **ChangeStream:** should resume from errors when iterating ([497952c](https://github.com/mongodb/node-mongodb-native/commit/497952cd577dc692dc2e0273028a74c818d31174))
52
- * **ChangeStream:** whitelist resumable errors ([#2337](https://github.com/mongodb/node-mongodb-native/issues/2337)) ([a9d3965](https://github.com/mongodb/node-mongodb-native/commit/a9d39651e5a3d5e565a85d1eb503f56f07c4a1d3)), closes [#17](https://github.com/mongodb/node-mongodb-native/issues/17) [#18](https://github.com/mongodb/node-mongodb-native/issues/18)
53
- * **create_indexes:** add missing `bucketSize` option to list of valid options ([66c76c3](https://github.com/mongodb/node-mongodb-native/commit/66c76c32f900499e147656e07b2df7bc5e0bb1b5))
54
- * **GridFS:** emit error on bad options ([c71a4df](https://github.com/mongodb/node-mongodb-native/commit/c71a4dfdf1c4904321a2b50967b3379b13d774fb))
55
- * remove check for NonResumableChangeStreamError label ([f3ac635](https://github.com/mongodb/node-mongodb-native/commit/f3ac635663717dd9eb00bf8d3f938a56c98bcafb))
56
- * throw an error if `allowDiskUse` is used on MongoDB < 3.2 ([f95f697](https://github.com/mongodb/node-mongodb-native/commit/f95f697dde5ba1ae4c6a698ad29266dfd787a121))
57
- * typo with setting error labels on error object ([89638bf](https://github.com/mongodb/node-mongodb-native/commit/89638bf925482bb54c3dd956ffd6f2830d088c6a))
58
- * unordered bulk write should attempt to execute all batches ([d00a644](https://github.com/mongodb/node-mongodb-native/commit/d00a644e129ad9570a5727b7e259261204f259ae))
59
- * use async interruptable interval for server monitoring ([068ae83](https://github.com/mongodb/node-mongodb-native/commit/068ae83291fc30f76b23ea1120e77ce71053e29d))
60
- * writes within transactions are not retryable ([c13ec5c](https://github.com/mongodb/node-mongodb-native/commit/c13ec5c66623af164b688c79747eab8fe89b91d6))
61
-
62
- ## [3.6.0-beta.0](https://github.com/mongodb/node-mongodb-native/compare/v3.5.5...v3.6.0-beta.0) (2020-04-14)
11
+ * add host/port to cmap connection ([06a2444](https://github.com/mongodb/node-mongodb-native/commit/06a2444))
12
+ * update full list of index options ([0af3191](https://github.com/mongodb/node-mongodb-native/commit/0af3191))
63
13
 
64
14
 
65
15
  ### Features
66
16
 
67
- * add MONGODB-AWS as a supported auth mechanism ([7f3cfba](https://github.com/mongodb/node-mongodb-native/commit/7f3cfbac15f537aa2ca9da145063f10c61390406))
68
- * bump wire protocol version for 4.4 ([6d3f313](https://github.com/mongodb/node-mongodb-native/commit/6d3f313a9defd12489b621896439b3f9ec8cb1ae))
69
- * deprecate `oplogReplay` for find commands ([24155e7](https://github.com/mongodb/node-mongodb-native/commit/24155e7905422460afc7e6abb120c596f40712c1))
70
- * directConnection adds unify behavior for replica set discovery ([c5d60fc](https://github.com/mongodb/node-mongodb-native/commit/c5d60fc4619227697ef2102437fe5c8b111909d2))
71
- * expand use of error labels for retryable writes ([c775a4a](https://github.com/mongodb/node-mongodb-native/commit/c775a4a1c53b8476eff6c9759b5647c9cbfa4e04))
72
- * support `allowDiskUse` for find commands ([dbc0b37](https://github.com/mongodb/node-mongodb-native/commit/dbc0b3722516a128c253bf85366a3432756ff92a))
73
- * support creating collections and indexes in transactions ([17e4c88](https://github.com/mongodb/node-mongodb-native/commit/17e4c88575b734d2d8ff94ca7f68b731a0bad326))
74
- * support passing a hint to findOneAndReplace/findOneAndUpdate ([faee15b](https://github.com/mongodb/node-mongodb-native/commit/faee15b686b895b84fd0b52c1e69e0caec769732))
75
- * support shorter SCRAM conversations ([6b9ff05](https://github.com/mongodb/node-mongodb-native/commit/6b9ff0561d14818bf07f4946ade04fc54683d0b9))
76
- * use error labels for retryable writes in legacy topologies ([fefc165](https://github.com/mongodb/node-mongodb-native/commit/fefc1651a885ec28758271c9e3c36104b05bdb75))
77
-
17
+ * **db:** deprecate createCollection strict mode ([4cc6bcc](https://github.com/mongodb/node-mongodb-native/commit/4cc6bcc))
78
18
 
79
- ### Bug Fixes
80
19
 
81
- * **ChangeStream:** whitelist change stream resumable errors ([8a9c108](https://github.com/mongodb/node-mongodb-native/commit/8a9c1084430de9d6253ca9c61c9258c85835bb94)), closes [#17](https://github.com/mongodb/node-mongodb-native/issues/17) [#18](https://github.com/mongodb/node-mongodb-native/issues/18)
82
- * always return empty array for selection on unknown topology ([af57b57](https://github.com/mongodb/node-mongodb-native/commit/af57b578dd603faa7b66983232de2bc7e417dae1))
83
- * correctly use template string for connection string error message ([814e278](https://github.com/mongodb/node-mongodb-native/commit/814e27869d90a1dfa01118bb96ff1273e0cef323))
84
- * don't depend on private node api for `Timeout` wrapper ([e6dc1f4](https://github.com/mongodb/node-mongodb-native/commit/e6dc1f48d62b68ba56b93359d7aa755c08985867))
85
- * **sdam:** use ObjectId comparison to track maxElectionId ([db991d6](https://github.com/mongodb/node-mongodb-native/commit/db991d6916306d1fe08508d4c3e8f7a37d7fd21f))
86
- * only consider MongoError subclasses for retryability ([265fe40](https://github.com/mongodb/node-mongodb-native/commit/265fe40cf29992764d1ab030a1ee4dca97cd7c7c))
87
- * pass options into `commandSupportsReadConcern` ([e855c83](https://github.com/mongodb/node-mongodb-native/commit/e855c83d8b73f4ce57a11193a1e52461ab2cd4db))
88
- * store name of collection for more informative error messages ([979d41e](https://github.com/mongodb/node-mongodb-native/commit/979d41e14f5acf69bac094b3863591ee8e01fd9c))
89
- * support write concern provided as string in `fromOptions` ([637f428](https://github.com/mongodb/node-mongodb-native/commit/637f4288c1edb799267ccbce6d25a49304f6149c))
90
- * use properly camel cased form of `mapReduce` for command ([c1ed2c1](https://github.com/mongodb/node-mongodb-native/commit/c1ed2c1ce4c6f2d40cd1c7b84ad672a90a09c83b))
91
20
 
92
21
  <a name="3.6.0-beta.0"></a>
93
22
  # [3.6.0-beta.0](https://github.com/mongodb/node-mongodb-native/compare/v3.5.5...v3.6.0-beta.0) (2020-04-14)
@@ -33,6 +33,8 @@ class Connection extends EventEmitter {
33
33
  this.address = streamIdentifier(stream);
34
34
  this.bson = options.bson;
35
35
  this.socketTimeout = typeof options.socketTimeout === 'number' ? options.socketTimeout : 360000;
36
+ this.host = options.host || 'localhost';
37
+ this.port = options.port || 27017;
36
38
  this.monitorCommands =
37
39
  typeof options.monitorCommands === 'boolean' ? options.monitorCommands : false;
38
40
  this.closed = false;
@@ -1,85 +1,92 @@
1
1
  'use strict';
2
+ const dns = require('dns');
3
+
2
4
  const AuthProvider = require('./auth_provider').AuthProvider;
3
5
  const retrieveKerberos = require('../utils').retrieveKerberos;
6
+ const MongoError = require('../error').MongoError;
7
+
8
+ const kGssapiClient = Symbol('GSSAPI_CLIENT');
4
9
  let kerberos;
5
10
 
6
11
  class GSSAPI extends AuthProvider {
7
- auth(authContext, callback) {
8
- const connection = authContext.connection;
12
+ prepare(handshakeDoc, authContext, callback) {
13
+ const host = authContext.options.host;
14
+ const port = authContext.options.port;
9
15
  const credentials = authContext.credentials;
10
-
16
+ if (!host || !port || !credentials) {
17
+ return callback(
18
+ new MongoError(
19
+ `Connection must specify: ${host ? 'host' : ''}, ${port ? 'port' : ''}, ${
20
+ credentials ? 'host' : 'credentials'
21
+ }.`
22
+ )
23
+ );
24
+ }
11
25
  if (kerberos == null) {
12
26
  try {
13
27
  kerberos = retrieveKerberos();
14
28
  } catch (e) {
15
- return callback(e, null);
29
+ return callback(e);
16
30
  }
17
31
  }
18
-
19
- // TODO: Destructure this
20
32
  const username = credentials.username;
21
33
  const password = credentials.password;
22
34
  const mechanismProperties = credentials.mechanismProperties;
23
- const gssapiServiceName =
35
+ const serviceName =
24
36
  mechanismProperties['gssapiservicename'] ||
25
37
  mechanismProperties['gssapiServiceName'] ||
26
38
  'mongodb';
27
-
28
- const MongoAuthProcess = kerberos.processes.MongoAuthProcess;
29
- const authProcess = new MongoAuthProcess(
30
- connection.host,
31
- connection.port,
32
- gssapiServiceName,
33
- mechanismProperties
34
- );
35
-
36
- authProcess.init(username, password, err => {
37
- if (err) return callback(err, false);
38
-
39
- authProcess.transition('', (err, payload) => {
40
- if (err) return callback(err, false);
41
-
42
- const command = {
43
- saslStart: 1,
44
- mechanism: 'GSSAPI',
45
- payload,
46
- autoAuthorize: 1
47
- };
48
-
49
- connection.command('$external.$cmd', command, (err, result) => {
50
- if (err) return callback(err, false);
51
-
52
- const doc = result.result;
53
- authProcess.transition(doc.payload, (err, payload) => {
54
- if (err) return callback(err, false);
55
- const command = {
56
- saslContinue: 1,
57
- conversationId: doc.conversationId,
58
- payload
59
- };
60
-
61
- connection.command('$external.$cmd', command, (err, result) => {
62
- if (err) return callback(err, false);
63
-
64
- const doc = result.result;
65
- authProcess.transition(doc.payload, (err, payload) => {
66
- if (err) return callback(err, false);
67
- const command = {
39
+ performGssapiCanonicalizeHostName(host, mechanismProperties, (err, host) => {
40
+ if (err) return callback(err);
41
+ const initOptions = {};
42
+ if (password != null) {
43
+ Object.assign(initOptions, { user: username, password: password });
44
+ }
45
+ kerberos.initializeClient(
46
+ `${serviceName}${process.platform === 'win32' ? '/' : '@'}${host}`,
47
+ initOptions,
48
+ (err, client) => {
49
+ if (err) return callback(new MongoError(err));
50
+ if (client == null) return callback();
51
+ this[kGssapiClient] = client;
52
+ callback(undefined, handshakeDoc);
53
+ }
54
+ );
55
+ });
56
+ }
57
+ auth(authContext, callback) {
58
+ const connection = authContext.connection;
59
+ const credentials = authContext.credentials;
60
+ if (credentials == null) return callback(new MongoError('credentials required'));
61
+ const username = credentials.username;
62
+ const client = this[kGssapiClient];
63
+ if (client == null) return callback(new MongoError('gssapi client missing'));
64
+ function externalCommand(command, cb) {
65
+ return connection.command('$external.$cmd', command, cb);
66
+ }
67
+ client.step('', (err, payload) => {
68
+ if (err) return callback(err);
69
+ externalCommand(saslStart(payload), (err, response) => {
70
+ const result = response.result;
71
+ if (err) return callback(err);
72
+ negotiate(client, 10, result.payload, (err, payload) => {
73
+ if (err) return callback(err);
74
+ externalCommand(saslContinue(payload, result.conversationId), (err, response) => {
75
+ const result = response.result;
76
+ if (err) return callback(err);
77
+ finalize(client, username, result.payload, (err, payload) => {
78
+ if (err) return callback(err);
79
+ externalCommand(
80
+ {
68
81
  saslContinue: 1,
69
- conversationId: doc.conversationId,
82
+ conversationId: result.conversationId,
70
83
  payload
71
- };
72
-
73
- connection.command('$external.$cmd', command, (err, result) => {
74
- if (err) return callback(err, false);
75
-
76
- const response = result.result;
77
- authProcess.transition(null, err => {
78
- if (err) return callback(err, null);
79
- callback(null, response);
80
- });
81
- });
82
- });
84
+ },
85
+ (err, result) => {
86
+ if (err) return callback(err);
87
+ callback(undefined, result);
88
+ }
89
+ );
83
90
  });
84
91
  });
85
92
  });
@@ -87,5 +94,58 @@ class GSSAPI extends AuthProvider {
87
94
  });
88
95
  }
89
96
  }
90
-
91
97
  module.exports = GSSAPI;
98
+
99
+ function saslStart(payload) {
100
+ return {
101
+ saslStart: 1,
102
+ mechanism: 'GSSAPI',
103
+ payload,
104
+ autoAuthorize: 1
105
+ };
106
+ }
107
+ function saslContinue(payload, conversationId) {
108
+ return {
109
+ saslContinue: 1,
110
+ conversationId,
111
+ payload
112
+ };
113
+ }
114
+ function negotiate(client, retries, payload, callback) {
115
+ client.step(payload, (err, response) => {
116
+ // Retries exhausted, raise error
117
+ if (err && retries === 0) return callback(err);
118
+ // Adjust number of retries and call step again
119
+ if (err) return negotiate(client, retries - 1, payload, callback);
120
+ // Return the payload
121
+ callback(undefined, response || '');
122
+ });
123
+ }
124
+ function finalize(client, user, payload, callback) {
125
+ // GSS Client Unwrap
126
+ client.unwrap(payload, (err, response) => {
127
+ if (err) return callback(err);
128
+ // Wrap the response
129
+ client.wrap(response || '', { user }, (err, wrapped) => {
130
+ if (err) return callback(err);
131
+ // Return the payload
132
+ callback(undefined, wrapped);
133
+ });
134
+ });
135
+ }
136
+ function performGssapiCanonicalizeHostName(host, mechanismProperties, callback) {
137
+ const canonicalizeHostName =
138
+ typeof mechanismProperties.gssapiCanonicalizeHostName === 'boolean'
139
+ ? mechanismProperties.gssapiCanonicalizeHostName
140
+ : false;
141
+ if (!canonicalizeHostName) return callback(undefined, host);
142
+ // Attempt to resolve the host name
143
+ dns.resolveCname(host, (err, r) => {
144
+ if (err) return callback(err);
145
+ // Get the first resolve host id
146
+ if (Array.isArray(r) && r.length > 0) {
147
+ return callback(undefined, r[0]);
148
+ }
149
+ callback(undefined, host);
150
+ });
151
+ }
package/lib/db.js CHANGED
@@ -492,7 +492,7 @@ Db.prototype.collection = function(name, options, callback) {
492
492
  * @param {object} [options.pkFactory] A primary key factory object for generation of custom _id keys.
493
493
  * @param {(ReadPreference|string)} [options.readPreference] The preferred read preference (ReadPreference.PRIMARY, ReadPreference.PRIMARY_PREFERRED, ReadPreference.SECONDARY, ReadPreference.SECONDARY_PREFERRED, ReadPreference.NEAREST).
494
494
  * @param {boolean} [options.serializeFunctions=false] Serialize functions on any object.
495
- * @param {boolean} [options.strict=false] Returns an error if the collection does not exist
495
+ * @param {boolean} [options.strict=false] DEPRECATED: Returns an error if the collection does not exist
496
496
  * @param {boolean} [options.capped=false] Create a capped collection.
497
497
  * @param {boolean} [options.autoIndexId=true] DEPRECATED: Create an index on the _id field of the document, True by default on MongoDB 2.6 - 3.0
498
498
  * @param {number} [options.size] The size of the capped collection in bytes.
@@ -513,7 +513,7 @@ Db.prototype.collection = function(name, options, callback) {
513
513
  Db.prototype.createCollection = deprecateOptions(
514
514
  {
515
515
  name: 'Db.createCollection',
516
- deprecatedOptions: ['autoIndexId'],
516
+ deprecatedOptions: ['autoIndexId', 'strict'],
517
517
  optionsIndex: 1
518
518
  },
519
519
  function(name, options, callback) {
@@ -7,15 +7,35 @@ const MongoError = require('../core').MongoError;
7
7
  const parseIndexOptions = require('../utils').parseIndexOptions;
8
8
  const maxWireVersion = require('../core/utils').maxWireVersion;
9
9
 
10
- const validIndexOptions = new Set([
10
+ const VALID_INDEX_OPTIONS = new Set([
11
+ 'background',
11
12
  'unique',
13
+ 'name',
12
14
  'partialFilterExpression',
13
15
  'sparse',
14
- 'background',
15
16
  'expireAfterSeconds',
16
17
  'storageEngine',
17
18
  'collation',
18
- 'bucketSize'
19
+
20
+ // text indexes
21
+ 'weights',
22
+ 'default_language',
23
+ 'language_override',
24
+ 'textIndexVersion',
25
+
26
+ // 2d-sphere indexes
27
+ '2dsphereIndexVersion',
28
+
29
+ // 2d indexes
30
+ 'bits',
31
+ 'min',
32
+ 'max',
33
+
34
+ // geoHaystack Indexes
35
+ 'bucketSize',
36
+
37
+ // wildcard indexes
38
+ 'wildcardProjection'
19
39
  ]);
20
40
 
21
41
  class CreateIndexesOperation extends CommandOperationV2 {
@@ -42,7 +62,7 @@ class CreateIndexesOperation extends CommandOperationV2 {
42
62
  const indexSpec = { name, key: indexParameters.fieldHash };
43
63
  // merge valid index options into the index spec
44
64
  for (let optionName in options) {
45
- if (validIndexOptions.has(optionName)) {
65
+ if (VALID_INDEX_OPTIONS.has(optionName)) {
46
66
  indexSpec[optionName] = options[optionName];
47
67
  }
48
68
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mongodb",
3
- "version": "3.6.0",
3
+ "version": "3.6.1",
4
4
  "description": "The official MongoDB driver for Node.js",
5
5
  "main": "index.js",
6
6
  "files": [
@@ -65,6 +65,9 @@
65
65
  },
66
66
  "scripts": {
67
67
  "atlas": "mocha --opts '{}' ./test/manual/atlas_connectivity.test.js",
68
+ "check:kerberos": "mocha --opts '{}' -t 60000 test/manual/kerberos.test.js",
69
+ "check:ldap": "mocha --opts '{}' test/manual/ldap.test.js",
70
+ "check:tls": "mocha --opts '{}' test/manual/tls_support.test.js",
68
71
  "test": "npm run lint && mocha --recursive test/functional test/unit test/core",
69
72
  "test-nolint": "mocha --recursive test/functional test/unit test/core",
70
73
  "coverage": "istanbul cover mongodb-test-runner -- -t 60000 test/core test/unit test/functional",