Release Notes for MongoDB 3.2

Dec 8, 2015

MongoDB 3.2 is now available. Key features include WiredTiger as thedefault storage engine, replication election enhancements, configservers as replica sets, readConcern, and document validations.

OpsManager 2.0 is also available. See the Ops Manager documentation and the Ops Managerrelease notesfor more information.

Minor Releases

3.2.22 - Dec 28, 2018

3.2.21 - Sep 7, 2018

3.2.20 - May 10, 2018

3.2.19 - Feb 6, 2018

3.2.18 - Nov 29, 2017

3.2.17 - Sept 28, 2017

Issues fixed:

3.2.16 - Jul 27, 2017

Issues fixed:

3.2.15 - Jul 5, 2017

Issues fixed:

3.2.14 -Jun 13, 2017

Issues fixed:

3.2.13 – May 1, 2017

Issues fixed:

3.2.12 – Feb 1, 2017

Issues fixed:

3.2.11 – Nov 18, 2016

Issues fixed:

  • SERVER-26182: In a mixed version replica set with v3.2 andv3.0 members, a sync of a v3.2 member from a v3.0 member can resultin a query response that exceed 16 MB BSON size limit and crash thev3.2 member.
  • SERVER-24662: Upgrade to Perl compatible regular expressions(PCRE 8.39).
  • SERVER-26652 Invalid definitions in systemd configurationfor Debian.
  • SERVER-24386: killCursor operation during aggregationpipeline can cause segmentation fault.
  • 3.2.11 Changelog
  • All JIRA issues closed in 3.2.11%20AND%20resolution%3D%27Fixed%27%20and%20fixversion%3D%273.2.11%27)

3.2.10 – Sep 30, 2016

Issues fixed:

  • SERVER-25974: When WT cache utilization is full, applicationthreads can stall for an extended period of time.
  • SERVER-20306: MongoDB with WiredTiger may experienceexcessive memory fragmentation, leading to swapping and/orout-of-memory errors.
  • SERVER-16801: When updating a field of one numerical type tothe same number of different numerical type, update operationconsiders it as a noop.
  • 3.2.10 Changelog
  • All JIRA issues closed in 3.2.10%20AND%20resolution%3D%27Fixed%27%20and%20fixversion%3D%273.2.10%27)

3.2.9 – Aug 16, 2016

Issues fixed:

3.2.8 – Jul 12, 2016

Issues fixed:

3.2.7 – Jun 7, 2016

Issues fixed:

3.2.6 – Apr 28, 2016

Issues fixed:

3.2.5 – Apr 14, 2016

Issues fixed:

3.2.4 – Mar 8, 2016

Issues fixed:

3.2.3 – Feb 17, 2016

Issues fixed:

3.2.2 – Feb 16, 2016

Replaced by MongoDB 3.2.3. Users wishing torun MongoDB 3.2 should skip 3.2.2 and upgrade directly to 3.2.3.

3.2.1 – Jan 12, 2016

Issues fixed:

WiredTiger as Default

Starting in 3.2, MongoDB uses the WiredTiger as the default storageengine.

To specify the MMAPv1 storage engine, you must specify the storageengine setting either:

  • On the command line with the —storageEngine option:
  1. mongod --storageEngine mmapv1
  1. storage:
  2. engine: mmapv1

Note

For existing deployments, if you do not specify the—storageEngine or the storage.engine setting,MongoDB 3.2 can automatically determine the storage engineused to create the data files in the —dbpath orstorage.dbPath.

If specifying —storageEngine or storage.engine,mongod will not start if dbPath contains data filescreated by a storage engine other than the one specified.

See also

Default Storage Engine Change

WiredTiger Default Cache Size

Starting in MongoDB 3.2, the WiredTiger internal cache, by default,will use the larger of either:

  • 60% of RAM minus 1 GB, or
  • 1 GB.

For more information, see WiredTiger and Memory Use.

WiredTiger Journal Write Frequency

MongoDB 3.2 configures WiredTiger to write to the journal files atevery 50 milliseconds. This is in addition to the existing journal writeintervals and conditions. For more information, see Journaling Process.

Replication Election Enhancements

Starting in MongoDB 3.2, MongoDB reduces replica set failover timeand accelerates the detection of multiple simultaneous primaries.

As part of this enhancement, MongoDB introduces a version 1 of thereplication protocol. New replica sets will, by default, useprotocolVersion: 1. Previous versions ofMongoDB use version 0 of the protocol.

In addition, MongoDB introduces a new replica set configuration optionelectionTimeoutMillis.electionTimeoutMillis specifies the time limit inmilliseconds for detecting when a replica set’s primary is unreachable.

electionTimeoutMillis only applies if using theversion 1 of the replication protocol.

See also

Replica Set Protocol Version

Sharded Cluster Enhancements

MongoDB 3.2 deprecates the use of three mirrored mongodinstances for config servers.

Instead, starting in 3.2, the config servers for a sharded cluster can bedeployed as a replica set. The replica set config servers must run theWiredTiger storage engine.

This change improves consistency across the config servers, sinceMongoDB can take advantage of the standard replica set read and writeprotocols for sharding config data. In addition, this allows a shardedcluster to have more than 3 config servers since a replica set can haveup to 50 members.

For more information, see Config Servers.To deploy a new sharded cluster with replica set config servers,see Deploy a Sharded Cluster.

MongoDB 3.2 deprecates the use of master-slave replication forcomponents of sharded clusters.

Starting in 3.2, mongos, during its startup, will continueto try to contact the config servers until one becomes available. Inprevious versions, mongos, during its startup, would shutdown if it could not find a config server.

readConcern

MongoDB 3.2 introduces the readConcern query option for replica sets and replicaset shards. For the WiredTiger storage engine, the readConcern option allows clients tochoose a level of isolation for their reads. You can specify areadConcern of "majority" to read data that has been written toa majority of nodes and thus cannot be rolled back. By default, MongoDBuses a readConcern of "local" to return the most recent dataavailable to the node at the time of the query, even if the data hasnot been persisted to a majority of nodes and may be rolled back. Withthe MMAPv1 storage engine, you can only specify areadConcern of "local".

readConcern requires MongoDB drivers updated for MongoDB 3.2.

For details on readConcern, including operations that support theoption, see Read Concern.

Partial Indexes

MongoDB 3.2 provides the option to create indexes that only indexthe documents in a collection that meet a specified filter expression.By indexing a subset of the documents in a collection, partial indexeshave lower storage requirements and reduced performance costs for indexcreation and maintenance. You can specify a partialFilterExpressionoption for all MongoDB index types.

The partialFilterExpression option accepts a document that specifies thecondition using:

For details, see Partial Indexes.

Document Validation

Starting in 3.2, MongoDB provides the capability to validate documentsduring updates and insertions. Validation rules are specified on aper-collection basis.

To specify document validation on a new collection, use the newvalidator option in the db.createCollection() method. Toadd document validation to an existing collection, use the newvalidator option in the collMod command. For moreinformation, see Schema Validation.

To view the validation specifications for a collection, use thedb.getCollectionInfos() method.

The following commands can bypass validation per operation using thenew option bypassDocumentValidation:

For deployments that have enabled access control, you must havebypassDocumentValidation action. The built-in rolesdbAdmin and restore provide this action.

Aggregation Framework Enhancements

MongoDB introduces:

New Aggregation Stages

StageDescriptionSyntax
$sampleRandomly selects N documents from its input.{ $sample: { size: <positive integer> } }
$indexStatsReturns statistics on index usage.{ $indexStats: { } }
$lookupPerforms a left outer join with another collection.
  1. { $lookup: { from: <collection to join>, localField: <fieldA>, foreignField: <fieldB>, as: <output array field> }}

New Accumulators for $group Stage

AccumulatorDescriptionSyntax
$stdDevSampCalculates standard deviation.{ $stdDevSamp: <array> }
$stdDevPopCalculates population standard deviation.{ $stdDevPop: <array> }

New Aggregation Arithmetic Operators

OperatorDescriptionSyntax
$sqrtCalculates the square root.{ $sqrt: <number> }
$absReturns the absolute value of a number.{ $abs: <number> }
$logCalculates the log of a number in the specified base.{ $log: [ <number>, <base> ] }
$log10Calculates the log base 10 of a number.{ $log10: <number> }
$lnCalculates the natural log of a number.{ $ln: <number> }
$powRaises a number to the specified exponent.{ $pow: [ <number>, <exponent> ] }
$expRaises e to the specified exponent.{ exp: <number> }
$truncTruncates a number to its integer.{ $trunc: <number> }
$ceilReturns the smallest integer greater than or equal to thespecified number.{ $ceil: <number> }
$floorReturns the largest integer less than or equal to the specifiednumber.{ floor: <number> }

New Aggregation Array Operators

OperatorDescriptionSyntax
$sliceReturns a subset of an array.{ $slice: [ <array>, <n> ] }or{ $slice: [ <array>, <position>, <n> ] }
$arrayElemAtReturns the element at the specified array index.{ $arrayElemAt: [ <array>, <idx> ] }
$concatArraysConcatenates arrays.
  1. { $concatArrays: [ <array1>, <array2>, ]}
$isArrayDetermines if the operand is an array.{ $isArray: [ <expression> ] }
$filterSelects a subset of the array based on the condition.
  1. { $filter: { input: <array>, as: <string>, cond: <expression> }}

Accumulator Expression Availability

Starting in version 3.2, the following accumulator expressions,previously only available in the $group stage, are now alsoavailable in the $project stage:

When used as part of the $project stage, these accumulatorexpressions can accept either:

  • A single argument: <accumulator> : <arg>
  • Multiple arguments: <accumulator> : [ <arg1>, <arg2>, … ]

General Enhancements

  • In MongoDB 3.2, $project stage supports using the squarebrackets [] to directly create new array fields. For an example,see Project New Array Fields.

  • MongoDB 3.2 introduces the minDistance option for the$geoNear stage.

  • $unwind stage no longer errors on non-array operand. Ifthe operand does not resolve to an array but is not missing, null, oran empty array, $unwind treats the operand as a singleelement array.

$unwind stage can:

  • include the array index of the array element in the output byspecifying a new option includeArrayIndex in the stagespecification.
  • output those documents where the array field is missing, null or anempty array by specifying a new optionpreserveNullAndEmptyArrays in the stage specification.To support these new features, $unwind can now take analternate syntax. See $unwind for details.

Optimization

Indexes can cover aggregation operations.

MongoDB improves the overall performance of the pipelinein large sharded clusters.

If the pipeline starts with an exact $match on a shard key,the entire pipeline runs on the matching shard only. Previously, thepipeline would have been split, and the work of merging it would haveto be done on the primary shard.

For aggregation operations that run on multiple shards, if theoperations do not require running on the database’s primary shard,these operations can route the results to any shard to merge theresults and avoid overloading the primary shard for that database.Aggregation operations that require running on the database’s primaryshard are the $out stage and $lookup stage.

Compatibility

For compatibility changes, see Aggregation Compatibility Changes.

MongoDB Tools Enhancements

Encrypted Storage Engine

Enterprise Feature

Available in MongoDB Enterprise only.

Important

Available for the WiredTiger Storage Engine only.

Encryption at rest, when used in conjunction with transport encryptionand good security policies that protect relevant accounts, passwords,and encryption keys, can help ensure compliance with security andprivacy standards, including HIPAA, PCI-DSS, and FERPA.

MongoDB Enterprise 3.2 introduces a native encryption option for theWiredTiger storage engine. This feature allows MongoDB to encrypt datafiles such that only parties with the decryption key can decode andread the data. For detail, see Encrypted Storage Engine.

Text Search Enhancements

text Index Version 3

MongoDB 3.2 introduces a version 3 of the text index. Key features of the new version of the index are:

Starting in MongoDB 3.2, version 3 is the default version for newtext indexes.

See also

Text Index Version 3 Compatibility

$text Operator Enhancements

The $text operator adds support for:

For more information and examples, see the $text operatorreference sections Case Insensitivity andDiacritic Insensitivity.

Support for Additional Languages

Enterprise Feature

Available in MongoDB Enterprise only.

Starting in 3.2, MongoDB Enterprise provides support for thefollowing languages: Arabic, Farsi (specifically Dari and IranianPersian dialects), Urdu, Simplified Chinese, and Traditional Chinese.

For details, see Text Search with Basis Technology Rosette Linguistics Platform.

New Storage Engines

inMemory Storage Engine

Enterprise Feature

Available in MongoDB Enterprise only.

MongoDB Enterprise 3.2 provides an in-memory storage engine. Other than somemetadata, the in-memory storage engine does not maintain any on-disk data. Byavoiding disk I/O, the in-memory storage engine allows for more predictablelatency of database operations.

To select this storage engine, specify

  • inMemory for the —storageEngine option or thestorage.engine setting.
  • —dbpath. Although the in-memory storage engine does not writedata to the filesystem, it maintains in the —dbpath smallmetadata files and diagnostic data as well temporary files for buildinglarge indexes.

The inMemory storage engine uses document-level locking. For more details,see In-Memory Storage Engine.

ephemeralForTest Storage Engine

MongoDB 3.2 provides a new for-test storage engine. Other than some metadata,the for-test storage engine does not maintain any on-disk data, removing theneed to clean up between test runs. The for-test storage engine is unsupported.

Warning

For test purposes only. Do not use in production.

To select this storage engine, specify

  • ephemeralForTest for the —storageEngine option or thestorage.engine setting.
  • —dbpath. Although the for-test storage engine does not write data tothe filesystem, it maintains small metadata files in the —dbpath.

The ephemeralForTest storage engine uses collection-level locking.

General Enhancements

Bit Test Query Operators

MongoDB 3.2 provides new query operators to test bit values:

SpiderMonkey JavaScript Engine

MongoDB 3.2 uses SpiderMonkey as the JavaScript engine for themongo shell and mongod server. SpiderMonkeyprovides support for additional platforms and has an improved memorymanagement model.

This change affects all JavaScript behavior including the commandsmapReduce, group, and the query operator$where; however, this change should be completelytransparent to the user.

See also

SpiderMonkey Compatibility Changes

mongo Shell and CRUD API

To provide consistency with the MongoDB drivers’ CRUD(Create/Read/Update/Delete) API, the mongo shell introducesadditional CRUD methods that are consistent with the drivers’ CRUD API:

New APIDescription
db.collection.bulkWrite()Equivalent to initializing Bulk() operations builder,using Bulk methods to add operations, andrunning Bulk.execute() to execute the operations.MongoDB 3.2 deprecates Bulk() and its associatedmethods.
db.collection.deleteMany()Equivalent to db.collection.remove().
db.collection.deleteOne()Equivalent to db.collection.remove() with thejustOne set to true; i.e.db.collection.remove( <query>, true ) ordb.collection.remove( <query>, { justOne: true } ).
db.collection.findOneAndDelete()Equivalent to db.collection.findAndModify() methodwith remove set to true.
db.collection.findOneAndReplace()Equivalent to db.collection.findAndModify() methodwith update set to a replacement document.
db.collection.findOneAndUpdate()Equivalent to db.collection.findAndModify() methodwith update set to a document that specifies modificationsusing update operators.
db.collection.insertMany()Equivalent to db.collection.insert() methodwith an array of documents as the parameter.
db.collection.insertOne()Equivalent to db.collection.insert() methodwith a single document as the parameter.
db.collection.replaceOne()Equivalent to db.collection.update( <query>,<update> ) method with a replacementdocument as the <update> parameter.
db.collection.updateMany()Equivalent to db.collection.update( <query>,<update>, { multi: true, … })method with an <update> document that specifiesmodifications using update operators and the multi option set totrue.
db.collection.updateOne()Equivalent to db.collection.update( <query>,<update> ) method with an<update> document that specifies modifications usingupdate operators.

WiredTiger and fsyncLock

Starting in MongoDB 3.2, the WiredTiger storage engine supports thefsync command with the lock option or themongo shell method db.fsyncLock(). That is, forthe WiredTiger storage engine, these operations can guarantee that thedata files do not change, ensuring consistency for the purposes ofcreating backups.

Platform Support

Starting in 3.2, 32-bit binaries are deprecated and will beunavailable in future releases.

MongoDB 3.2 also deprecates support for Red Hat Enterprise Linux 5.

$type Operator Accepts String Aliases

$type operator accepts string aliases for the BSON types inaddition to the numbers corresponding to the BSON types.

explain() Support for distinct() Operation

db.collection.explain() adds support fordb.collection.distinct() method. For more information, seedb.collection.explain().

explain Support for findAndModify and distinct Commands

explain adds support for the distinct andfindAndModify commands. For more information, seeexplain.

Deprecation of the HTTP Interface

Starting in 3.2, MongoDB deprecates its HTTP interface.

keysExamined Count Includes the Last Scanned Key

For explain operations run in executionStats orallPlansExecution mode, the explain output contains the keysExamined statistic,representing the number of index keys examined during index scans.

Prior to 3.2, keysExamined count in some queries did not includethe last scanned key. As of 3.2 this error has been corrected. For moreinformation, see :data:~explain.executionStats.executionStages.inputStage.keysExamined.

The diagnostic logs and the system profiler report on this statistic.

Geospatial Optimization

MongoDB 3.2 introduces version 3 of 2dsphereindexes, which index GeoJSON geometries at a finer gradation. The new version improvesperformance of 2dsphere index queries oversmaller regions. In addition, for both 2d indexes and2dsphere indexes, the performance ofgeoNear queries has been improved for dense datasets.

See also

2dsphere Index Version 3 Compatibility

Diagnostic Data Capture

To facilitate analysis of the MongoDB server behavior by MongoDBengineers, MongoDB 3.2 introduces a diagnostic data collectionmechanism for logging server statistics to diagnostic files at periodicintervals. By default, the mechanism captures data at 1 secondintervals. To modify the interval, seediagnosticDataCollectionPeriodMillis.

MongoDB creates a diagnostic.data directory under themongod instance’s —dbpath or storage.dbPath.The diagnostic data is stored in files under this directory.

The maximum size of the diagnostic files is configurable with thediagnosticDataCollectionFileSizeMB, and the maximum sizeof the diagnostic.data directory is configurable withdiagnosticDataCollectionDirectorySizeMB.

The default values for the capture interval and the maximum sizes arechosen to provide useful data to MongoDB engineers with minimal impacton performance and storage size. Typically, these values will only needmodifications as requested by MongoDB engineers for specific diagnosticpurposes.

Write Concern

  • For replica sets using protocolVersion: 1, secondaries acknowledge write operations after thesecondary members have written to their respective on-diskjournals, regardless of the joption.
  • For replica sets using protocolVersion: 1, w: "majority"implies j: true.
  • With j: true, MongoDB returns only after therequested number of members, including the primary, have written to thejournal. Previously j: true write concern in areplica set only requires the primary to write to the journal,regardless of the w: write concern.

journalCommitInterval for WiredTiger

MongoDB 3.2 adds support for specifying the journal commit interval forthe WiredTiger storage engine. See —journalCommitIntervaloption. In previous versions, the option is applicable to MMAPv1storage engine only.

For the corresponding configuration file setting, MongoDB 3.2 adds thestorage.journal.commitIntervalMssetting and deprecates storage.mmapv1.journal.commitIntervalMs. The deprecated storage.mmapv1.journal.commitIntervalMs setting acts as an alias to the newstorage.journal.commitIntervalMssetting.

Changes Affecting Compatibility

Some MongoDB 3.2 changes can affect compatibility and may require useractions. For a detailed list of compatibility changes, seeCompatibility Changes in MongoDB 3.2.

Upgrade Process

See Upgrade MongoDB to 3.2 for full upgrade instructions.

Known Issues in 3.2.1

List of known issues in the 3.2.1 release:

  • Clients may fail to discover new primaries when clock skew betweennodes is greater than electionTimeout: SERVER-21744
  • fromMigrate flag never set for deletes in oplog: SERVER-21678
  • Running explain with a read preference in a v3.2 mongo shellconnected to a v3.0 mongos or in a v3.0 mongo shell connectedto a v3.0 mongos but with v3.2 shards is incompatible:SERVER-21661
  • Results of the connPoolStats command are no longer correct: SERVER-21597
  • ApplyOps background index creation may deadlock: SERVER-21583
  • Performance regression for w:majority writes with replica setprotocolVersion 1: SERVER-21581
  • Performance regression on unicode-aware text processing logic (textindex v3): SERVER-19936
  • Results from the $indexStats operator do not take into account querieswhich use the $match or mapReduce functions: SERVER-22048

Known Issues in 3.2.0

List of known issues in the 3.2.0 release:

  • findAndModify operations not captured by the profiler: SERVER-21772
  • getMore command does not set "nreturned" operationcounter: SERVER-21750
  • Clients may fail to discover new primaries when clock skew betweennodes is greater than electionTimeout: SERVER-21744
  • fromMigrate flag never set for deletes in oplog: SERVER-21678
  • Running explain with a read preference in a v3.2 mongo shellconnected to a v3.0 mongos or in a v3.0 mongo shell connectedto a v3.0 mongos but with v3.2 shards is incompatible:SERVER-21661
  • Results of the connPoolStats command are no longer correct: SERVER-21597
  • ApplyOps background index creation may deadlock: SERVER-21583
  • Performance regression for w:majority writes with replica setprotocolVersion 1: SERVER-21581
  • Performance regression on unicode-aware text processing logic (textindex v3): SERVER-19936
  • Severe performance regression in insert workload under Windows withWiredTiger: SERVER-21792
  • Results from the $indexStats operator do not take into account querieswhich use the $match or mapReduce functions: SERVER-22048

Download

To download MongoDB 3.2, go to the downloads page.

See also