Release notes
*Sourced from [mongodb's releases](https://github.com/mongodb/node-mongodb-native/releases).*
> ## v3.2.1
> The MongoDB Node.js team is pleased to announce version 3.2.1 of the driver.
>
> *Due to a publishing snafu v3.2.1 was immediately published without a proper v3.2.0 release*
>
>
Release Highlights
>
>
2.x EOL
> With the v3.1.0 release we officially deprecated the 2.x driver. With this release that driver
> is effectively EOL, and will no longer be supported. Please update your driver as soon as possible.
>
>
Unified Topology
> In this release we are very excited to announce the immediate availability of a complete rewrite of the driver's "topology" layer. This is the core brains of the driver responsible for things like server selection, server discovery and monitoring. This work combines the three existing topology concepts (`Mongos`, `ReplSet`, and `Server`) into a single type `Topology`. The new `Topology` type uses the same machinery to represent all three types, greatly improving our ability to maintain the code, and reducing the chance for bug duplication.
>
> The `Topology` class no longer uses a callback store, instead relying on a server selection loop for operation execution. This means failed operations will fail faster, with more accurate stack traces and specifics about the failure. It generally makes it much easier to reason about what the driver is doing each time an operation is executed.
>
> You can enable it with the `useUnifiedTopology` feature flag passed to your `MongoClient` constructor, like so:
> ```
> const client = MongoClient('mongodb://localhost:27017', { useUnifiedTopology: true });
> ```
>
> This topology layer will replace the existing topologies in a breaking 4.x release later this year, so we strongly encourage our users to try it out as soon as possible.
>
>
`withTransaction` helper
> Reliably committing a transaction in the face of errors can be a complicated endeavor using the MongoDB 4.0 drivers API. This version introduces a `withTransaction` helper method on the `ClientSession` object that allows application logic to be executed within a transaction. This method is capable of retrying either the commit operation or entire transaction as needed (and when the error permits) to better ensure that the transaction can complete successfully. Consider using this for all but the most complicated of transactions use cases.
>
> A call to `withTransaction` begins a new transaction, executes the provided function, and then attempts to commit the transaction. The function passed to `withTransaction` must take a `session` parameter, and this session must be passed to all methods within the function. If some error is encountered, it will attempt to re-commit the transaction before ultimately failing back to the user after aborting the transaction.
> **NOTE:** A mentioned, the passed in function MAY be retried multiple times, please keep this in mind when executing non-database operations within the function.
>
> Here’s an example of it in action:
> ```
> const client = new MongoClient();
> await client.connect();
>
> const session = client.startSession();
>
> // NOTE: the `withTransaction` method only supports functions that return a `Promise`
> try {
> await session.withTransaction(async function(session) {
> const coll = client.db('foo').collection('coll');
> await coll.insertOne({ a: 42 }, { session });
> });
> } catch (err) {
> // transaction failed after attempted retry
> console.dir({ err });
> }
> ```
>
>
Cursors support asyncInterator and for..await..of loops
> `Symbol.asyncIterator` is defined on cursors for Node.js versions that support it (>=v10.x.x). This allows you to use for..await..of loops with cursors:
> ... (truncated)
Changelog
*Sourced from [mongodb's changelog](https://github.com/mongodb/node-mongodb-native/blob/master/HISTORY.md).*
> ## [3.2.1](https://github.com/mongodb/node-mongodb-native/compare/v3.2.0...v3.2.1) (2019-03-21)
>
>
> ### Features
>
> * **core:** update to mongodb-core v3.2.1 ([30b0100](https://github.com/mongodb/node-mongodb-native/commit/30b0100))
>
>
>
>
> # [3.2.0](https://github.com/mongodb/node-mongodb-native/compare/v3.1.13...v3.2.0) (2019-03-21)
>
>
> ### Bug Fixes
>
> * **aggregate:** do not send batchSize for aggregation with $out ([ddb8d90](https://github.com/mongodb/node-mongodb-native/commit/ddb8d90))
> * **bulkWrite:** always count undefined values in bson size for bulk ([436d340](https://github.com/mongodb/node-mongodb-native/commit/436d340))
> * **db_ops:** rename db to add user on ([79931af](https://github.com/mongodb/node-mongodb-native/commit/79931af))
> * **mongo_client_ops:** only skip authentication if no authMechanism is specified ([3b6957d](https://github.com/mongodb/node-mongodb-native/commit/3b6957d))
> * **mongo-client:** ensure close callback is called with client ([f39e881](https://github.com/mongodb/node-mongodb-native/commit/f39e881))
>
>
> ### Features
>
> * **core:** pin to mongodb-core v3.2.0 ([22af15a](https://github.com/mongodb/node-mongodb-native/commit/22af15a))
> * **Cursor:** adds support for AsyncIterator in cursors ([b972c1e](https://github.com/mongodb/node-mongodb-native/commit/b972c1e))
> * **db:** add database-level aggregation ([b629b21](https://github.com/mongodb/node-mongodb-native/commit/b629b21))
> * **mongo-client:** remove deprecated `logout` and print warning ([542859d](https://github.com/mongodb/node-mongodb-native/commit/542859d))
> * **topology-base:** support passing callbacks to `close` method ([7c111e0](https://github.com/mongodb/node-mongodb-native/commit/7c111e0))
> * **transactions:** support pinning mongos for sharded txns ([3886127](https://github.com/mongodb/node-mongodb-native/commit/3886127))
> * **unified-sdam:** backport unified SDAM to master for v3.2.0 ([79f33ca](https://github.com/mongodb/node-mongodb-native/commit/79f33ca))
>
>
>
> Commits
- [`0e6153b`](https://github.com/mongodb/node-mongodb-native/commit/0e6153b52a50a333fd44e206e0ecea7db762132b) chore(release): 3.2.1
- [`30b0100`](https://github.com/mongodb/node-mongodb-native/commit/30b0100e21caf025a1b53401cb417af346142714) feat(core): update to mongodb-core v3.2.1
- [`2604bc7`](https://github.com/mongodb/node-mongodb-native/commit/2604bc7fd99d9ca665354f7110827cf20d5b258a) chore(release): 3.2.0
- [`22af15a`](https://github.com/mongodb/node-mongodb-native/commit/22af15a76277bb984530c237693979159c657af9) feat(core): pin to mongodb-core v3.2.0
- [`eebb6c8`](https://github.com/mongodb/node-mongodb-native/commit/eebb6c8be68388710458f3e740a13e7abddbf66c) test: fix change stream expectations for mongodb-latest
- [`9002ca4`](https://github.com/mongodb/node-mongodb-native/commit/9002ca43b7250d5dfe8d76e5a54d66376036ae9f) docs: updating documentation version and branch
- [`d7123a9`](https://github.com/mongodb/node-mongodb-native/commit/d7123a93a7c13762bda86b9593b843ef291b39eb) Added links to compatibility with MongoDB & NodeJS.
- [`caf1169`](https://github.com/mongodb/node-mongodb-native/commit/caf116957882e93a96d35c5f4fc9658594a17190) Added links to compatibility with MongoDB & NodeJS.
- [`305f4c0`](https://github.com/mongodb/node-mongodb-native/commit/305f4c01e54942fbb5fd4eb520f35ec6b88c52cf) doc: merge 3.1.1 release notes into master
- [`c6fd568`](https://github.com/mongodb/node-mongodb-native/commit/c6fd56828be2613165e2637f05c44c4d74a78443) refactor: put recovery tokens behind a feature flag for now
- Additional commits viewable in [compare view](https://github.com/mongodb/node-mongodb-native/compare/v3.1.13...v3.2.1)
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.
Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot ignore this [patch|minor|major] version` will close this PR and stop Dependabot creating any more for this minor/major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
- `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language
- `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language
- `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language
- `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language
- `@dependabot badge me` will comment on this PR with code to add a "Dependabot enabled" badge to your readme
Additionally, you can set the following in your Dependabot [dashboard](https://app.dependabot.com):
- Update frequency (including time of day and day of week)
- Automerge options (never/patch/minor, and dev/runtime dependencies)
- Pull request limits (per update run and/or open at any time)
- Out-of-range updates (receive only lockfile updates, if desired)
- Security updates (receive only security updates, if desired)
Finally, you can contact us by mentioning @dependabot.
Bumps mongodb from 3.1.13 to 3.2.1.
Release notes
*Sourced from [mongodb's releases](https://github.com/mongodb/node-mongodb-native/releases).* > ## v3.2.1 > The MongoDB Node.js team is pleased to announce version 3.2.1 of the driver. > > *Due to a publishing snafu v3.2.1 was immediately published without a proper v3.2.0 release* > >Release Highlights
> >2.x EOL
> With the v3.1.0 release we officially deprecated the 2.x driver. With this release that driver > is effectively EOL, and will no longer be supported. Please update your driver as soon as possible. > >Unified Topology
> In this release we are very excited to announce the immediate availability of a complete rewrite of the driver's "topology" layer. This is the core brains of the driver responsible for things like server selection, server discovery and monitoring. This work combines the three existing topology concepts (`Mongos`, `ReplSet`, and `Server`) into a single type `Topology`. The new `Topology` type uses the same machinery to represent all three types, greatly improving our ability to maintain the code, and reducing the chance for bug duplication. > > The `Topology` class no longer uses a callback store, instead relying on a server selection loop for operation execution. This means failed operations will fail faster, with more accurate stack traces and specifics about the failure. It generally makes it much easier to reason about what the driver is doing each time an operation is executed. > > You can enable it with the `useUnifiedTopology` feature flag passed to your `MongoClient` constructor, like so: > ``` > const client = MongoClient('mongodb://localhost:27017', { useUnifiedTopology: true }); > ``` > > This topology layer will replace the existing topologies in a breaking 4.x release later this year, so we strongly encourage our users to try it out as soon as possible. > >`withTransaction` helper
> Reliably committing a transaction in the face of errors can be a complicated endeavor using the MongoDB 4.0 drivers API. This version introduces a `withTransaction` helper method on the `ClientSession` object that allows application logic to be executed within a transaction. This method is capable of retrying either the commit operation or entire transaction as needed (and when the error permits) to better ensure that the transaction can complete successfully. Consider using this for all but the most complicated of transactions use cases. > > A call to `withTransaction` begins a new transaction, executes the provided function, and then attempts to commit the transaction. The function passed to `withTransaction` must take a `session` parameter, and this session must be passed to all methods within the function. If some error is encountered, it will attempt to re-commit the transaction before ultimately failing back to the user after aborting the transaction. > **NOTE:** A mentioned, the passed in function MAY be retried multiple times, please keep this in mind when executing non-database operations within the function. > > Here’s an example of it in action: > ``` > const client = new MongoClient(); > await client.connect(); > > const session = client.startSession(); > > // NOTE: the `withTransaction` method only supports functions that return a `Promise` > try { > await session.withTransaction(async function(session) { > const coll = client.db('foo').collection('coll'); > await coll.insertOne({ a: 42 }, { session }); > }); > } catch (err) { > // transaction failed after attempted retry > console.dir({ err }); > } > ``` > >Cursors support asyncInterator and for..await..of loops
> `Symbol.asyncIterator` is defined on cursors for Node.js versions that support it (>=v10.x.x). This allows you to use for..await..of loops with cursors: > ... (truncated)Changelog
*Sourced from [mongodb's changelog](https://github.com/mongodb/node-mongodb-native/blob/master/HISTORY.md).* > ## [3.2.1](https://github.com/mongodb/node-mongodb-native/compare/v3.2.0...v3.2.1) (2019-03-21) > > > ### Features > > * **core:** update to mongodb-core v3.2.1 ([30b0100](https://github.com/mongodb/node-mongodb-native/commit/30b0100)) > > > > > # [3.2.0](https://github.com/mongodb/node-mongodb-native/compare/v3.1.13...v3.2.0) (2019-03-21) > > > ### Bug Fixes > > * **aggregate:** do not send batchSize for aggregation with $out ([ddb8d90](https://github.com/mongodb/node-mongodb-native/commit/ddb8d90)) > * **bulkWrite:** always count undefined values in bson size for bulk ([436d340](https://github.com/mongodb/node-mongodb-native/commit/436d340)) > * **db_ops:** rename db to add user on ([79931af](https://github.com/mongodb/node-mongodb-native/commit/79931af)) > * **mongo_client_ops:** only skip authentication if no authMechanism is specified ([3b6957d](https://github.com/mongodb/node-mongodb-native/commit/3b6957d)) > * **mongo-client:** ensure close callback is called with client ([f39e881](https://github.com/mongodb/node-mongodb-native/commit/f39e881)) > > > ### Features > > * **core:** pin to mongodb-core v3.2.0 ([22af15a](https://github.com/mongodb/node-mongodb-native/commit/22af15a)) > * **Cursor:** adds support for AsyncIterator in cursors ([b972c1e](https://github.com/mongodb/node-mongodb-native/commit/b972c1e)) > * **db:** add database-level aggregation ([b629b21](https://github.com/mongodb/node-mongodb-native/commit/b629b21)) > * **mongo-client:** remove deprecated `logout` and print warning ([542859d](https://github.com/mongodb/node-mongodb-native/commit/542859d)) > * **topology-base:** support passing callbacks to `close` method ([7c111e0](https://github.com/mongodb/node-mongodb-native/commit/7c111e0)) > * **transactions:** support pinning mongos for sharded txns ([3886127](https://github.com/mongodb/node-mongodb-native/commit/3886127)) > * **unified-sdam:** backport unified SDAM to master for v3.2.0 ([79f33ca](https://github.com/mongodb/node-mongodb-native/commit/79f33ca)) > > > >Commits
- [`0e6153b`](https://github.com/mongodb/node-mongodb-native/commit/0e6153b52a50a333fd44e206e0ecea7db762132b) chore(release): 3.2.1 - [`30b0100`](https://github.com/mongodb/node-mongodb-native/commit/30b0100e21caf025a1b53401cb417af346142714) feat(core): update to mongodb-core v3.2.1 - [`2604bc7`](https://github.com/mongodb/node-mongodb-native/commit/2604bc7fd99d9ca665354f7110827cf20d5b258a) chore(release): 3.2.0 - [`22af15a`](https://github.com/mongodb/node-mongodb-native/commit/22af15a76277bb984530c237693979159c657af9) feat(core): pin to mongodb-core v3.2.0 - [`eebb6c8`](https://github.com/mongodb/node-mongodb-native/commit/eebb6c8be68388710458f3e740a13e7abddbf66c) test: fix change stream expectations for mongodb-latest - [`9002ca4`](https://github.com/mongodb/node-mongodb-native/commit/9002ca43b7250d5dfe8d76e5a54d66376036ae9f) docs: updating documentation version and branch - [`d7123a9`](https://github.com/mongodb/node-mongodb-native/commit/d7123a93a7c13762bda86b9593b843ef291b39eb) Added links to compatibility with MongoDB & NodeJS. - [`caf1169`](https://github.com/mongodb/node-mongodb-native/commit/caf116957882e93a96d35c5f4fc9658594a17190) Added links to compatibility with MongoDB & NodeJS. - [`305f4c0`](https://github.com/mongodb/node-mongodb-native/commit/305f4c01e54942fbb5fd4eb520f35ec6b88c52cf) doc: merge 3.1.1 release notes into master - [`c6fd568`](https://github.com/mongodb/node-mongodb-native/commit/c6fd56828be2613165e2637f05c44c4d74a78443) refactor: put recovery tokens behind a feature flag for now - Additional commits viewable in [compare view](https://github.com/mongodb/node-mongodb-native/compare/v3.1.13...v3.2.1)Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot ignore this [patch|minor|major] version` will close this PR and stop Dependabot creating any more for this minor/major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) - `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language - `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language - `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language - `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language - `@dependabot badge me` will comment on this PR with code to add a "Dependabot enabled" badge to your readme Additionally, you can set the following in your Dependabot [dashboard](https://app.dependabot.com): - Update frequency (including time of day and day of week) - Automerge options (never/patch/minor, and dev/runtime dependencies) - Pull request limits (per update run and/or open at any time) - Out-of-range updates (receive only lockfile updates, if desired) - Security updates (receive only security updates, if desired) Finally, you can contact us by mentioning @dependabot.