7.2.0 (2026-01-29)
The MongoDB Node.js team is pleased to announce version 7.2.0 of the bson package!
Release Notes
EJSON now supports ignoreUndefined
serialize supports an option, ignoreUndefined, which instructs the serializer to skip any keys whose values are undefined.
This option has been added to EJSON:
> EJSON.stringify({ a: undefined }, { ignoreUndefined: true });
'{}'
> EJSON.stringify({ a: undefined }, { ignoreUndefined: false });
'{"a":null}'
> EJSON.serialize({ a: undefined }, { ignoreUndefined: true });
{}
> EJSON.serialize({ a: undefined }, { ignoreUndefined: false });
{ a: null }This option defaults to false.
Buffer.copy() now present in ByteUtils
ByteUtils now contains a copy() method, we behaves identically to Nodejs' Buffer.copy() method.
Features
- NODE-7328: Add ignoreUndefined option to EJSON APIs (#853) (5cf00c2)
- NODE-7414: add copy method to ByteUtils (#867) (ffa77c6)
Documentation
We invite you to try the bson library immediately, and report any issues to the NODE project.