mongodb 3.6.0 → 3.6.4

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.
Files changed (55) hide show
  1. package/HISTORY.md +60 -71
  2. package/README.md +1 -3
  3. package/lib/admin.js +10 -8
  4. package/lib/aggregation_cursor.js +7 -8
  5. package/lib/bulk/common.js +5 -4
  6. package/lib/change_stream.js +1 -1
  7. package/lib/cmap/connection.js +3 -1
  8. package/lib/cmap/connection_pool.js +5 -15
  9. package/lib/collection.js +111 -65
  10. package/lib/core/auth/gssapi.js +132 -72
  11. package/lib/core/auth/x509.js +1 -1
  12. package/lib/core/connection/connect.js +1 -1
  13. package/lib/core/connection/connection.js +3 -4
  14. package/lib/core/connection/pool.js +3 -3
  15. package/lib/core/cursor.js +22 -12
  16. package/lib/core/sdam/monitor.js +14 -11
  17. package/lib/core/sdam/topology.js +2 -1
  18. package/lib/core/sdam/topology_description.js +1 -0
  19. package/lib/core/sessions.js +29 -35
  20. package/lib/core/topologies/mongos.js +2 -1
  21. package/lib/core/topologies/replset.js +14 -8
  22. package/lib/core/topologies/server.js +5 -4
  23. package/lib/core/uri_parser.js +9 -2
  24. package/lib/core/wireprotocol/query.js +12 -11
  25. package/lib/core/wireprotocol/write_command.js +10 -1
  26. package/lib/cursor.js +15 -13
  27. package/lib/db.js +44 -28
  28. package/lib/explain.js +55 -0
  29. package/lib/gridfs/grid_store.js +14 -9
  30. package/lib/gridfs-stream/upload.js +5 -3
  31. package/lib/mongo_client.js +14 -11
  32. package/lib/operations/add_user.js +3 -1
  33. package/lib/operations/admin_ops.js +1 -1
  34. package/lib/operations/aggregate.js +5 -7
  35. package/lib/operations/command_v2.js +13 -2
  36. package/lib/operations/common_functions.js +14 -27
  37. package/lib/operations/connect.js +32 -9
  38. package/lib/operations/create_indexes.js +24 -4
  39. package/lib/operations/delete_many.js +15 -2
  40. package/lib/operations/delete_one.js +15 -2
  41. package/lib/operations/distinct.js +10 -2
  42. package/lib/operations/find.js +7 -1
  43. package/lib/operations/find_and_modify.js +14 -1
  44. package/lib/operations/find_one.js +4 -0
  45. package/lib/operations/map_reduce.js +20 -1
  46. package/lib/operations/operation.js +11 -1
  47. package/lib/operations/update_many.js +23 -2
  48. package/lib/operations/update_one.js +22 -16
  49. package/lib/operations/validate_collection.js +1 -1
  50. package/lib/topologies/mongos.js +1 -1
  51. package/lib/topologies/server.js +1 -1
  52. package/lib/url_parser.js +19 -14
  53. package/lib/utils.js +39 -7
  54. package/lib/write_concern.js +18 -4
  55. package/package.json +35 -9
package/HISTORY.md CHANGED
@@ -2,92 +2,81 @@
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)
5
+ ### [3.6.4](https://github.com/mongodb/node-mongodb-native/compare/v3.6.3...v3.6.4) (2021-02-02)
6
6
 
7
7
 
8
8
  ### Features
9
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))
10
+ * add explain support ([#2626](https://github.com/mongodb/node-mongodb-native/issues/2626)) ([a827807](https://github.com/mongodb/node-mongodb-native/commit/a8278070992d2de4134dc0841b4027a6cc745a93))
11
+ * Deprecate top-level write concern option keys ([#2624](https://github.com/mongodb/node-mongodb-native/issues/2624)) ([0516d93](https://github.com/mongodb/node-mongodb-native/commit/0516d93f74de4b58a99e8455e59678d4b09cd4a7))
23
12
 
24
13
 
25
14
  ### Bug Fixes
26
15
 
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)
16
+ * Allow GridFS write stream to destroy ([#2702](https://github.com/mongodb/node-mongodb-native/issues/2702)) ([b5e9d67](https://github.com/mongodb/node-mongodb-native/commit/b5e9d67d5cd9b1912a349789cf2a122e00a46d1b))
17
+ * awaitable isMaster timeout must respect connectTimeoutMS ([#2627](https://github.com/mongodb/node-mongodb-native/issues/2627)) ([b365c50](https://github.com/mongodb/node-mongodb-native/commit/b365c5061ded832e1682167edac58e8a04b05fc4))
18
+ * don't add empty query string items to connection string ([8897259](https://github.com/mongodb/node-mongodb-native/commit/889725980ec1e3b4be4a74170bea0a3e3d23cf13))
19
+ * don't reset monitor if we aren't streaming topology changes ([a10171b](https://github.com/mongodb/node-mongodb-native/commit/a10171b57d2414f6df2aa8ffe9c2d3938ad838d1))
20
+ * dont parse tls/ssl file paths in uri ([#2718](https://github.com/mongodb/node-mongodb-native/issues/2718)) ([f89e4c1](https://github.com/mongodb/node-mongodb-native/commit/f89e4c1bd59c64664e8c9aa218bcb856be325d34))
21
+ * hasAtomicOperator check respects toBSON transformation ([#2696](https://github.com/mongodb/node-mongodb-native/issues/2696)) ([60936dc](https://github.com/mongodb/node-mongodb-native/commit/60936dca74167de239d1bb51a23cc9870860bdc4))
22
+ * honor ignoreUndefined on findAndModify commands ([#2671](https://github.com/mongodb/node-mongodb-native/issues/2671)) ([a25b67c](https://github.com/mongodb/node-mongodb-native/commit/a25b67c6ac13b6347cb78c4fc56613f3daf44300))
23
+ * ignore ENOTFOUND during TXT record lookup ([2036fe7](https://github.com/mongodb/node-mongodb-native/commit/2036fe7b298b9678e29ede87c1035c748ff89fcd))
24
+ * respect readPreference and writeConcern from connection string ([#2711](https://github.com/mongodb/node-mongodb-native/issues/2711)) ([b657c8c](https://github.com/mongodb/node-mongodb-native/commit/b657c8c4f3f86018cc4824f84cb22e1527d9f9af))
25
+ * restore auto direct connection behavior ([#2719](https://github.com/mongodb/node-mongodb-native/issues/2719)) ([617d9de](https://github.com/mongodb/node-mongodb-native/commit/617d9dec5180c5f7b67bd8c944c168d4cbd27e1c))
26
+ * support empty TXT records in legacy url parser ([2fa5c5f](https://github.com/mongodb/node-mongodb-native/commit/2fa5c5f2a113920baa8e67a1c0d65432690d37fc))
27
+ * transition topology state before async calls ([#2637](https://github.com/mongodb/node-mongodb-native/issues/2637)) ([9df093c](https://github.com/mongodb/node-mongodb-native/commit/9df093c1d46e1f8616c7a979324923205ac3dcd2))
28
+ * **cursor:** don't use other operation's session for cloned cursor operation ([#2705](https://github.com/mongodb/node-mongodb-native/issues/2705)) ([8082c89](https://github.com/mongodb/node-mongodb-native/commit/8082c89f8ef3624d22f4bdd6066b6f72c44f763d))
29
+ * **find:** correctly translate timeout option into noCursorTimeout ([#2700](https://github.com/mongodb/node-mongodb-native/issues/2700)) ([e257e6b](https://github.com/mongodb/node-mongodb-native/commit/e257e6b19d810920bafc579e725e09bd0607b74b))
30
+
31
+ <a name="3.6.3"></a>
32
+ ## [3.6.3](https://github.com/mongodb/node-mongodb-native/compare/v3.6.1...v3.6.3) (2020-11-06)
63
33
 
64
34
 
65
- ### Features
35
+ ### Bug Fixes
36
+
37
+ * add peerDependenciesMeta to mark optional deps ([#2606](https://github.com/mongodb/node-mongodb-native/issues/2606)) ([186090e](https://github.com/mongodb/node-mongodb-native/commit/186090e))
38
+ * adds topology discovery for sharded cluster ([f8fd310](https://github.com/mongodb/node-mongodb-native/commit/f8fd310))
39
+ * allow event loop to process during wait queue processing ([#2537](https://github.com/mongodb/node-mongodb-native/issues/2537)) ([4e03dfa](https://github.com/mongodb/node-mongodb-native/commit/4e03dfa))
40
+ * Change socket timeout default to 0 ([#2572](https://github.com/mongodb/node-mongodb-native/issues/2572)) ([89b77ed](https://github.com/mongodb/node-mongodb-native/commit/89b77ed))
41
+ * connection leak if wait queue member cancelled ([cafaa1b](https://github.com/mongodb/node-mongodb-native/commit/cafaa1b))
42
+ * correctly assign username to X509 auth command ([#2587](https://github.com/mongodb/node-mongodb-native/issues/2587)) ([9110a45](https://github.com/mongodb/node-mongodb-native/commit/9110a45))
43
+ * correctly re-establishes pipe destinations ([a6e7caf](https://github.com/mongodb/node-mongodb-native/commit/a6e7caf))
44
+ * Fix test filters and revert mocha version ([#2558](https://github.com/mongodb/node-mongodb-native/issues/2558)) ([0e5c45a](https://github.com/mongodb/node-mongodb-native/commit/0e5c45a))
45
+ * move kerberos client setup from prepare to auth ([#2608](https://github.com/mongodb/node-mongodb-native/issues/2608)) ([033b6e7](https://github.com/mongodb/node-mongodb-native/commit/033b6e7))
46
+ * permit waking async interval with unreliable clock ([e0e11bb](https://github.com/mongodb/node-mongodb-native/commit/e0e11bb))
47
+ * remove geoNear deprecation ([4955a52](https://github.com/mongodb/node-mongodb-native/commit/4955a52))
48
+ * revert use of setImmediate to process.nextTick ([#2611](https://github.com/mongodb/node-mongodb-native/issues/2611)) ([c9f9d5e](https://github.com/mongodb/node-mongodb-native/commit/c9f9d5e))
49
+ * sets primary read preference for writes ([ddcd03d](https://github.com/mongodb/node-mongodb-native/commit/ddcd03d))
50
+ * use options for readPreference in client ([6acced0](https://github.com/mongodb/node-mongodb-native/commit/6acced0))
51
+ * user roles take single string & DDL readPreference tests ([967de13](https://github.com/mongodb/node-mongodb-native/commit/967de13))
52
+
53
+
54
+
55
+ <a name="3.6.2"></a>
56
+ ## [3.6.2](https://github.com/mongodb/node-mongodb-native/compare/v3.6.1...v3.6.2) (2020-09-10)
57
+
58
+
59
+ ### Bug Fixes
66
60
 
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))
61
+ * allow event loop to process during wait queue processing ([#2537](https://github.com/mongodb/node-mongodb-native/issues/2537)) ([4e03dfa](https://github.com/mongodb/node-mongodb-native/commit/4e03dfa))
62
+
63
+
64
+
65
+ <a name="3.6.1"></a>
66
+ ## [3.6.1](https://github.com/mongodb/node-mongodb-native/compare/v3.6.0...v3.6.1) (2020-09-02)
77
67
 
78
68
 
79
69
  ### Bug Fixes
80
70
 
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))
71
+ * add host/port to cmap connection ([06a2444](https://github.com/mongodb/node-mongodb-native/commit/06a2444))
72
+ * update full list of index options ([0af3191](https://github.com/mongodb/node-mongodb-native/commit/0af3191))
73
+
74
+
75
+ ### Features
76
+
77
+ * **db:** deprecate createCollection strict mode ([4cc6bcc](https://github.com/mongodb/node-mongodb-native/commit/4cc6bcc))
78
+
79
+
91
80
 
92
81
  <a name="3.6.0-beta.0"></a>
93
82
  # [3.6.0-beta.0](https://github.com/mongodb/node-mongodb-native/compare/v3.5.5...v3.6.0-beta.0) (2020-04-14)
package/README.md CHANGED
@@ -1,7 +1,5 @@
1
1
  [![npm](https://nodei.co/npm/mongodb.png?downloads=true&downloadRank=true)](https://nodei.co/npm/mongodb/) [![npm](https://nodei.co/npm-dl/mongodb.png?months=6&height=3)](https://nodei.co/npm/mongodb/)
2
2
 
3
- [![Build Status](https://secure.travis-ci.org/mongodb/node-mongodb-native.svg?branch=2.1)](http://travis-ci.org/mongodb/node-mongodb-native)
4
- [![Coverage Status](https://coveralls.io/repos/github/mongodb/node-mongodb-native/badge.svg?branch=2.1)](https://coveralls.io/github/mongodb/node-mongodb-native?branch=2.1)
5
3
  [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/mongodb/node-mongodb-native?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge)
6
4
 
7
5
  # Description
@@ -15,7 +13,7 @@ The official [MongoDB](https://www.mongodb.com/) driver for Node.js. Provides a
15
13
  | what | where |
16
14
  |---------------|------------------------------------------------|
17
15
  | documentation | http://mongodb.github.io/node-mongodb-native |
18
- | api-doc | http://mongodb.github.io/node-mongodb-native/3.1/api |
16
+ | api-doc | http://mongodb.github.io/node-mongodb-native/3.6/api |
19
17
  | source | https://github.com/mongodb/node-mongodb-native |
20
18
  | mongodb | http://www.mongodb.org |
21
19
 
package/lib/admin.js CHANGED
@@ -166,10 +166,11 @@ Admin.prototype.ping = function(options, callback) {
166
166
  * @param {string} username The username.
167
167
  * @param {string} password The password.
168
168
  * @param {object} [options] Optional settings.
169
- * @param {(number|string)} [options.w] The write concern.
170
- * @param {number} [options.wtimeout] The write concern timeout.
171
- * @param {boolean} [options.j=false] Specify a journal write concern.
172
- * @param {boolean} [options.fsync=false] Specify a file sync write concern.
169
+ * @param {(number|string)} [options.w] **Deprecated** The write concern. Use writeConcern instead.
170
+ * @param {number} [options.wtimeout] **Deprecated** The write concern timeout. Use writeConcern instead.
171
+ * @param {boolean} [options.j=false] **Deprecated** Specify a journal write concern. Use writeConcern instead.
172
+ * @param {boolean} [options.fsync=false] **Deprecated** Specify a file sync write concern. Use writeConcern instead.
173
+ * @param {object|WriteConcern} [options.writeConcern] Specify write concern settings.
173
174
  * @param {object} [options.customData] Custom data associated with the user (only Mongodb 2.6 or higher)
174
175
  * @param {object[]} [options.roles] Roles associated with the created user (only Mongodb 2.6 or higher)
175
176
  * @param {ClientSession} [options.session] optional session to use for this operation
@@ -203,10 +204,11 @@ Admin.prototype.addUser = function(username, password, options, callback) {
203
204
  * @method
204
205
  * @param {string} username The username.
205
206
  * @param {object} [options] Optional settings.
206
- * @param {(number|string)} [options.w] The write concern.
207
- * @param {number} [options.wtimeout] The write concern timeout.
208
- * @param {boolean} [options.j=false] Specify a journal write concern.
209
- * @param {boolean} [options.fsync=false] Specify a file sync write concern.
207
+ * @param {(number|string)} [options.w] **Deprecated** The write concern. Use writeConcern instead.
208
+ * @param {number} [options.wtimeout] **Deprecated** The write concern timeout. Use writeConcern instead.
209
+ * @param {boolean} [options.j=false] **Deprecated** Specify a journal write concern. Use writeConcern instead.
210
+ * @param {boolean} [options.fsync=false] **Deprecated** Specify a file sync write concern. Use writeConcern instead.
211
+ * @param {object|WriteConcern} [options.writeConcern] Specify write concern settings.
210
212
  * @param {ClientSession} [options.session] optional session to use for this operation
211
213
  * @param {Admin~resultCallback} [callback] The command result callback
212
214
  * @return {Promise} returns Promise if no callback passed
@@ -3,7 +3,6 @@
3
3
  const MongoError = require('./core').MongoError;
4
4
  const Cursor = require('./cursor');
5
5
  const CursorState = require('./core/cursor').CursorState;
6
- const deprecate = require('util').deprecate;
7
6
 
8
7
  /**
9
8
  * @fileOverview The **AggregationCursor** class is an internal class that embodies an aggregation cursor on MongoDB
@@ -203,7 +202,7 @@ class AggregationCursor extends Cursor {
203
202
  /**
204
203
  * Add a unwind stage to the aggregation pipeline
205
204
  * @method
206
- * @param {number} field The unwind field name.
205
+ * @param {(string|object)} field The unwind field name or stage document.
207
206
  * @return {AggregationCursor}
208
207
  */
209
208
  unwind(field) {
@@ -225,12 +224,6 @@ class AggregationCursor extends Cursor {
225
224
  // aliases
226
225
  AggregationCursor.prototype.get = AggregationCursor.prototype.toArray;
227
226
 
228
- // deprecated methods
229
- deprecate(
230
- AggregationCursor.prototype.geoNear,
231
- 'The `$geoNear` stage is deprecated in MongoDB 4.0, and removed in version 4.2.'
232
- );
233
-
234
227
  /**
235
228
  * AggregationCursor stream data event, fired for each document in the cursor.
236
229
  *
@@ -329,7 +322,13 @@ deprecate(
329
322
 
330
323
  /**
331
324
  * Execute the explain for the cursor
325
+ *
326
+ * For backwards compatibility, a verbosity of true is interpreted as "allPlansExecution"
327
+ * and false as "queryPlanner". Prior to server version 3.6, aggregate()
328
+ * ignores the verbosity parameter and executes in "queryPlanner".
329
+ *
332
330
  * @method AggregationCursor.prototype.explain
331
+ * @param {'queryPlanner'|'queryPlannerExtended'|'executionStats'|'allPlansExecution'|boolean} [verbosity=true] - An optional mode in which to run the explain.
333
332
  * @param {AggregationCursor~resultCallback} [callback] The result callback.
334
333
  * @return {Promise} returns Promise if no callback passed
335
334
  */
@@ -1125,10 +1125,11 @@ class BulkOperationBase {
1125
1125
  * @method
1126
1126
  * @param {WriteConcern} [_writeConcern] Optional write concern. Can also be specified through options.
1127
1127
  * @param {object} [options] Optional settings.
1128
- * @param {(number|string)} [options.w] The write concern.
1129
- * @param {number} [options.wtimeout] The write concern timeout.
1130
- * @param {boolean} [options.j=false] Specify a journal write concern.
1131
- * @param {boolean} [options.fsync=false] Specify a file sync write concern.
1128
+ * @param {(number|string)} [options.w] **Deprecated** The write concern. Use writeConcern instead.
1129
+ * @param {number} [options.wtimeout] **Deprecated** The write concern timeout. Use writeConcern instead.
1130
+ * @param {boolean} [options.j=false] **Deprecated** Specify a journal write concern. Use writeConcern instead.
1131
+ * @param {boolean} [options.fsync=false] **Deprecated** Specify a file sync write concern. Use writeConcern instead.
1132
+ * @param {object|WriteConcern} [options.writeConcern] Specify write concern settings.
1132
1133
  * @param {BulkOperationBase~resultCallback} [callback] A callback that will be invoked when bulkWrite finishes/errors
1133
1134
  * @throws {MongoError} Throws error if the bulk object has already been executed
1134
1135
  * @throws {MongoError} Throws error if the bulk object does not have any operations
@@ -437,7 +437,7 @@ function createChangeStreamCursor(self, options) {
437
437
 
438
438
  if (self.pipeDestinations) {
439
439
  const cursorStream = changeStreamCursor.stream(self.streamOptions);
440
- for (let pipeDestination in self.pipeDestinations) {
440
+ for (let pipeDestination of self.pipeDestinations) {
441
441
  cursorStream.pipe(pipeDestination);
442
442
  }
443
443
  }
@@ -32,7 +32,9 @@ class Connection extends EventEmitter {
32
32
  this.id = options.id;
33
33
  this.address = streamIdentifier(stream);
34
34
  this.bson = options.bson;
35
- this.socketTimeout = typeof options.socketTimeout === 'number' ? options.socketTimeout : 360000;
35
+ this.socketTimeout = typeof options.socketTimeout === 'number' ? options.socketTimeout : 0;
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;
@@ -95,7 +95,7 @@ const VALID_POOL_OPTIONS = new Set([
95
95
 
96
96
  function resolveOptions(options, defaults) {
97
97
  const newOptions = Array.from(VALID_POOL_OPTIONS).reduce((obj, key) => {
98
- if (options.hasOwnProperty(key)) {
98
+ if (Object.prototype.hasOwnProperty.call(options, key)) {
99
99
  obj[key] = options[key];
100
100
  }
101
101
 
@@ -218,7 +218,6 @@ class ConnectionPool extends EventEmitter {
218
218
  return;
219
219
  }
220
220
 
221
- // add this request to the wait queue
222
221
  const waitQueueMember = { callback };
223
222
 
224
223
  const pool = this;
@@ -233,11 +232,8 @@ class ConnectionPool extends EventEmitter {
233
232
  }, waitQueueTimeoutMS);
234
233
  }
235
234
 
236
- // place the member at the end of the wait queue
237
235
  this[kWaitQueue].push(waitQueueMember);
238
-
239
- // process the wait queue
240
- processWaitQueue(this);
236
+ process.nextTick(() => processWaitQueue(this));
241
237
  }
242
238
 
243
239
  /**
@@ -250,10 +246,8 @@ class ConnectionPool extends EventEmitter {
250
246
  const stale = connectionIsStale(this, connection);
251
247
  const willDestroy = !!(poolClosed || stale || connection.closed);
252
248
 
253
- // Properly adjust state of connection
254
249
  if (!willDestroy) {
255
250
  connection.markAvailable();
256
-
257
251
  this[kConnections].push(connection);
258
252
  }
259
253
 
@@ -264,7 +258,7 @@ class ConnectionPool extends EventEmitter {
264
258
  destroyConnection(this, connection, reason);
265
259
  }
266
260
 
267
- processWaitQueue(this);
261
+ process.nextTick(() => processWaitQueue(this));
268
262
  }
269
263
 
270
264
  /**
@@ -434,7 +428,7 @@ function createConnection(pool, callback) {
434
428
 
435
429
  // otherwise add it to the pool for later acquisition, and try to process the wait queue
436
430
  pool[kConnections].push(connection);
437
- processWaitQueue(pool);
431
+ process.nextTick(() => processWaitQueue(pool));
438
432
  });
439
433
  }
440
434
 
@@ -483,7 +477,7 @@ function processWaitQueue(pool) {
483
477
  if (pool.waitQueueSize && (maxPoolSize <= 0 || pool.totalConnectionCount < maxPoolSize)) {
484
478
  createConnection(pool, (err, connection) => {
485
479
  const waitQueueMember = pool[kWaitQueue].shift();
486
- if (waitQueueMember == null) {
480
+ if (waitQueueMember == null || waitQueueMember[kCancelled]) {
487
481
  if (err == null) {
488
482
  pool[kConnections].push(connection);
489
483
  }
@@ -491,10 +485,6 @@ function processWaitQueue(pool) {
491
485
  return;
492
486
  }
493
487
 
494
- if (waitQueueMember[kCancelled]) {
495
- return;
496
- }
497
-
498
488
  if (err) {
499
489
  pool.emit('connectionCheckOutFailed', new ConnectionCheckOutFailedEvent(pool, err));
500
490
  } else {