yarn mongodb 4.11.0

latest releases: 6.10.0-dev.20241113.sha.20564f7a, 6.10.0-dev.20241112.sha.48ed47ec, 6.10.0-dev.20241109.sha.ed25d561...
2 years ago

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

Release Highlights

Recursive Schema Support

Version 4.3.0 of the Node driver added Typescript support for dot notation into our Filter type but
in the process it broke support for recursive schemas. In 4.11.0, we now support recursive schemas and
provide type safety on dot notation queries up to a depth of 9. Beyond a depth of 9, code still compiles
but is no longer type checked (it falls back to a type of any).

interface CircularSchema {
    name: string;
    nestedSchema: CircularSchema;
}

// we have a collection of type Collection<CircularSchema>

// below a depth of 9, type checking is enforced
collection.findOne({ 'nestedSchema.nestedSchema.nestedSchema.name': 25 }) // compilation error - name must be a string

// at a depth greater than 9, code compiles but is not type checked (11 deep)
collection.findOne({
    'nestedSchema.nestedSchema.nestedSchema.nestedSchema.nestedSchema.nestedSchema.nestedSchema.nestedSchema.nestedSchema.nestedSchema.name': 25
}) // NO compilation error

Note that our depth limit is a product of Typescript's recursive type limitations.

External Contributions

Many thanks to those who contributed to this release!

  • @ermik provided an extremely large schema to test compilation with, which made testing our new recursive schema support possible with large schemas straightforward.
  • @noahsilas for documentation improvements in change streams and fixing our Typescript types for read preferences.
  • @zendagin for adding Typescript support for hashed indexes.
  • @biniona-mongodb for fixing our parsing of TLS options.
  • @LinusU for removing support for server versions lower than our minimum supported server version and improving error messages for unacknowledged writes with hints.

Features

Bug Fixes


Documentation

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

Don't miss a new mongodb release

NewReleases is sending notifications on new releases.