MongoDB Node.js Driver 4.4.0 Released

The MongoDB Node.js team is pleased to announce version 4.4.0 of the mongodb package!

Release Highlights

This release includes a few new features described below.

KMIP

KMIP can now be configured as a KMS provider for CSFLE by providing the KMIP endpoint in the kmsProviders option.

Example:

new MongoClient(uri, { autoEncryption: { kmsProviders: { kmip: { endpoint: 'host:port' }}}})

CSFLE TLS

Custom TLS options can now be provided for connection to the KMS servers on a per KMS provider basis.

Example:

new MongoClient(uri, { autoEncryption: { tlsOptions: { aws: { tlsCAFile: 'path/to/file' }}}})

Valid options are tlsCAFile, tlsCertificateKeyFile, tlsCertificateKeyFilePassword and all accept strings as values: a string path to a certificate location on the file system or a string password.

Kerberos

Hostname canonicalization when using GSSAPI authentication now accepts 'none', 'forward', and 'forwardAndReverse' as auth mechanism properties. 'none' will perform no canonicalization (default), 'forward' will perform a forward cname lookup, and 'forwardAndReverse' will perform a forward lookup followed by a reverse PTR lookup on the IP address. Previous boolean values are still accepted and map to false -> 'none' and true -> 'forwardAndReverse'.

Example:

new MongoClient('mongodb://user:pass@host:port/db?authMechanism=GSSAPI&authMechanismProperties=CANONICALIZE_HOST_NAME=forward');

For cases when the service host name differs from the connection’s host name (most likely when creating new users on localhost), a SERVICE_HOST auth mechanism property may now be provided.

Example:

new MongoClient('mongodb://user:pass@host:port/db?authMechanism=GSSAPI&authMechanismProperties=SERVICE_HOST:example.com')

:warning: collection.count() and cursor.count()

In the 4.0.0 release of the driver, the deprecated collection.count() method was inadvertently changed to behave like collection.countDocuments(). In this release, we have updated the collection.count() behavior to match the legacy behavior:

  • If a query is passed in, collection.count will behave the same as collection.countDocuments and perform a collection scan.
  • If no query is passed in, collection.count will behave the same as collection.estimatedDocumentCount and rely on collection metadata.

We also deprecated the cursor.count() method and will remove it in the next major version along with collection.count(); please use collection.estimatedDocumentCount() or collection.countDocuments() instead.

Features

  • NODE-2938: add service host mechanism property (#3130) (46d5821)
  • NODE-2939: add new hostname canonicalization opts (#3131) (d0390d0)
  • NODE-3351: use hostname canonicalization (#3122) (f5c76f3)
  • NODE-3777: add csfle kmip support (#3070) (44bbd6e)
  • NODE-3867: deprecate cursor count and update v4 docs (#3127) (a48d7e2)

Bug Fixes

  • NODE-3621: fixed type of documentKey property on ChangeStreamDocument (#3118) (c63a21b)
  • NODE-3795: unexpected No auth provider for DEFAULT defined error (#3092) (fb38a56)
  • NODE-3813: unexpected type conversion of read preference tags (#3138) (3e7b894)
  • NODE-3878: use legacy count operation on collection.count (#3126) (12c6835)
  • NODE-3917: Throw an error when directConnection is set with multiple hosts (#3143) (b192493)

Documentation

We invite you to try the mongodb library immediately, and report any issues to the NODE project.

This topic was automatically closed after 90 days. New replies are no longer allowed.