What Is New in MongoDB 3.7
MongoDB 3.7 delivers a major step forward in scalability and developer productivity. This release is packed with enhancements to the aggregation framework, security, and overall database operations.
| Category | Key Changes |
|---|---|
| Aggregation Framework | New operators, type conversions, and array processing capabilities. |
| Security | Enhanced auditing, LDAP authorization, and x.509 certificate rotation. |
| Operability | Retryable writes, improved diagnostics, and background index build statistics. |
| Query Language | New array update operators and full support for JSON Schema validation. |
What are the major aggregation framework improvements?
The aggregation pipeline gets supercharged with powerful new operators for data manipulation. You can now convert between types and perform more complex array operations directly within your queries.
New Operators and Conversions
Operators like $replaceRoot and $replaceWith give you more control over reshaping documents. The new $convert operator handles type conversions, making it easier to clean and standardize data on the fly without extra application logic.
Enhanced Array Processing
Array manipulation becomes more flexible. You can merge arrays with $concatArrays and use new set operators like $setUnion and $setDifference to compare array contents directly in the aggregation pipeline.
How is security strengthened in this release?
Security gets a significant boost with more granular auditing and improved integration with external authentication systems. These features are crucial for deployments that require detailed oversight.
Auditing Enhancements
The auditing system now captures more events, including authentication and authorization successes and failures. You can also filter audit events by users, roles, or databases, which cuts down on noise and focuses on critical security events.
LDAP and x.509 Improvements
For enterprise users, LDAP authorization allows mapping LDAP groups to MongoDB roles. The new rotateCertificates command lets you update cluster certificates without needing a full restart, minimizing downtime.
What new operability features help with database management?
Operational resilience and visibility are key themes. Features like retryable writes and enhanced diagnostics make the database more robust and easier to debug.
Retryable Writes
This is a game-changer for driver connectivity. Supported drivers can automatically retry certain write operations a single time if they encounter a network error, preventing failures from transient issues.
Diagnostics and Index Builds
The currentOp command and database profiler now include more detailed information about index builds. You get better visibility into the progress and resource consumption of background index construction.
FAQ
Do I need to change my driver to use retryable writes?
Yes, you need a driver that supports the retryable writes specification. You'll also need to enable it in your connection string with retryWrites=true.
Can I use $jsonSchema validation on existing collections?
Absolutely. You can use the collMod command to add JSON Schema validation to a collection that already has data, giving you flexibility in adopting this feature.
What's the main benefit of the new $convert operator?
It simplifies data cleaning in aggregations. Instead of writing complex application code to handle mixed types, you can standardize field types directly within the database layer.
How does certificate rotation work without a restart?
The rotateCertificates command allows a rolling update across the cluster. Each member reloads its certificates on the fly, maintaining availability throughout the process.
Are the new array operators like $setUnion case-sensitive?
Yes, the array set operators perform comparisons based on the BSON comparison order, which is generally case-sensitive. This is important to remember when working with string data in arrays.