diff --git a/changelogs/generatechangelogs.py b/changelogs/generatechangelogs.py index 84edfe64220..bae0bf86177 100644 --- a/changelogs/generatechangelogs.py +++ b/changelogs/generatechangelogs.py @@ -52,7 +52,7 @@ def get_jira_issues(fixVersion): # Run the JIRA query query = "project in {0} and fixVersion = {1} and resolution = 'Fixed' ORDER BY key ASC".format( projects, fixVersion) - issues = auth_jira.search_issues(query, maxResults=200) + issues = auth_jira.search_issues(query, maxResults=500) logger.info("building changelog for {0} with {1} issue(s)".format( fixVersion, len(issues))) diff --git a/conf.py b/conf.py index 15066b3dcd5..f51fb5060a1 100644 --- a/conf.py +++ b/conf.py @@ -76,7 +76,7 @@ def has(self, *args): ]) source_constants = { - 'version-dev': '4.9', # Current development branch + 'version-dev': '4.3', # Current development branch 'package-name-org': 'mongodb-org', 'package-name-enterprise': 'mongodb-enterprise', 'version': version, diff --git a/config/build_conf.yaml b/config/build_conf.yaml index 9dfed986ce2..e67c1675b49 100644 --- a/config/build_conf.yaml +++ b/config/build_conf.yaml @@ -10,8 +10,8 @@ project: branched: true siteroot: true version: - release: '5.0.0' - branch: '5.0' + release: '4.4.2' + branch: '4.4' system: files: - 'pdfs.yaml' diff --git a/config/redirects b/config/redirects index 61785fd581e..6fb667595f0 100644 --- a/config/redirects +++ b/config/redirects @@ -1,8 +1,8 @@ define: base https://docs.mongodb.com define: versions v2.2 v2.4 v2.6 v3.0 v3.2 v3.4 v3.6 v4.0 v4.2 v4.4 master +symlink: upcoming -> v4.4 symlink: manual -> v4.4 -symlink: upcoming -> v4.4 -symlink: master -> v4.4 +symlink: v4.4 -> master [v2.2]: /${version}/core/read-operations-introduction -> ${base}/${version}/core/read-operations [v2.2]: /${version}/core/write-operations-introduction -> ${base}/${version}/core/write-operations @@ -1454,6 +1454,9 @@ raw: /master/release-notes/3.0-general-improvements -> ${base}/release-notes/3.0 [*-v4.0]: /${version}/reference/operator/aggregation/asinh -> ${base}/${version}/reference/operator/aggregation [*-v4.0]: /${version}/reference/operator/aggregation/acosh -> ${base}/${version}/reference/operator/aggregation [*-v4.0]: /${version}/reference/operator/aggregation/atanh -> ${base}/${version}/reference/operator/aggregation +[*-v4.0]: /${version}/reference/operator/aggregation/sinh -> ${base}/${version}/reference/operator/aggregation +[*-v4.0]: /${version}/reference/operator/aggregation/cosh -> ${base}/${version}/reference/operator/aggregation +[*-v4.0]: /${version}/reference/operator/aggregation/tanh -> ${base}/${version}/reference/operator/aggregation [*-v4.0]: /${version}/reference/operator/aggregation/degreesToRadians -> ${base}/${version}/reference/operator/aggregation [*-v4.0]: /${version}/reference/operator/aggregation/radiansToDegrees -> ${base}/${version}/reference/operator/aggregation @@ -1664,6 +1667,9 @@ raw: /v2.8/release-notes/2.8-changes -> ${base}/v3.0/release-notes/3.0 [v3.0-v4.0]: /${version}/reference/operator/aggregation/asinh -> ${base}/${version}/reference/operator/aggregation [v3.0-v4.0]: /${version}/reference/operator/aggregation/acosh -> ${base}/${version}/reference/operator/aggregation [v3.0-v4.0]: /${version}/reference/operator/aggregation/atanh -> ${base}/${version}/reference/operator/aggregation +[v3.0-v4.0]: /${version}/reference/operator/aggregation/sinh -> ${base}/${version}/reference/operator/aggregation +[v3.0-v4.0]: /${version}/reference/operator/aggregation/cosh -> ${base}/${version}/reference/operator/aggregation +[v3.0-v4.0]: /${version}/reference/operator/aggregation/tanh -> ${base}/${version}/reference/operator/aggregation [v3.0-v4.0]: /${version}/reference/operator/aggregation/degreesToRadians -> ${base}/${version}/reference/operator/aggregation [v3.0-v4.0]: /${version}/reference/operator/aggregation/radiansToDegrees -> ${base}/${version}/reference/operator/aggregation diff --git a/config/sphinx_local.yaml b/config/sphinx_local.yaml index f1615d22210..bce2d7f9f51 100644 --- a/config/sphinx_local.yaml +++ b/config/sphinx_local.yaml @@ -89,7 +89,6 @@ theme: - /release-notes/4.0 - /release-notes/4.2 - /release-notes/4.4 - - /release-notes/5.0 - /security - /sharding - /changeStreams diff --git a/snooty.toml b/snooty.toml index 4534449d385..533389b635a 100644 --- a/snooty.toml +++ b/snooty.toml @@ -1,11 +1,11 @@ name = "manual" [constants] -package-branch = "5.0" # For rc = testing. For GA, will be 4.2. -windows-dir-version = "5.0" # The wizard installs in 4.2 branch +package-branch = "4.4" # For rc = testing. For GA, will be 4.2. +windows-dir-version = "4.4" # The wizard installs in 4.2 branch package-name-org = "mongodb-org" package-name-enterprise = "mongodb-enterprise" -version = "5.0" +version = "4.4" release = "{+release+}" pgp-version = "{+version+}" pgp-fingerprint = "E162F504A20CDF15827F718D4B7C549A058F8B6B" diff --git a/source/administration/production-notes.txt b/source/administration/production-notes.txt index 9c500c8cd4d..1758c8fac47 100644 --- a/source/administration/production-notes.txt +++ b/source/administration/production-notes.txt @@ -97,7 +97,7 @@ Recommended Platforms ~~~~~~~~~~~~~~~~~~~~~ While MongoDB supports a variety of platforms, the following operating -systems are recommended for production use: +systems are recommended for production use on ``x86_64`` architecture: - Amazon Linux 2 - Debian 9 and 10 diff --git a/source/core/data-modeling-introduction.txt b/source/core/data-modeling-introduction.txt index 8548326a33a..228a76b8952 100644 --- a/source/core/data-modeling-introduction.txt +++ b/source/core/data-modeling-introduction.txt @@ -22,7 +22,7 @@ Flexible Schema Unlike SQL databases, where you must determine and declare a table's schema before inserting data, MongoDB's :term:`collections -`, by default, does not require its :doc:`documents +`, by default, do not require their :doc:`documents ` to have the same schema. That is: - The documents in a single collection do not need to have the same set diff --git a/source/core/index-compound.txt b/source/core/index-compound.txt index 76768bc7027..edece6bce02 100644 --- a/source/core/index-compound.txt +++ b/source/core/index-compound.txt @@ -39,10 +39,22 @@ operation that resembles the following prototype: .. include:: /includes/fact-index-specification-field-value.rst -.. important:: You may not create compound indexes that have - ``hashed`` index type. You will receive an error if you attempt to - create a compound index that includes :doc:`a hashed index - field `. +.. important:: + + Starting in MongoDB 4.4: + + - Compound indexes may contain **a single** :doc:`hashed index field + `. + - You will receive an error if you attempt to create a compound index + that contains more than one :doc:`hashed index field + `. + + In MongoDB 4.2 or earlier: + + - Compound indexes may **not** contain a :doc:`hashed index field + `. + - You will receive an error if you attempt to create a compound index + that contains a :doc:`hashed index field `. Consider a collection named ``products`` that holds documents that resemble the following document: diff --git a/source/core/index-creation.txt b/source/core/index-creation.txt index 24810de0576..e001e66cfb1 100644 --- a/source/core/index-creation.txt +++ b/source/core/index-creation.txt @@ -129,21 +129,25 @@ Index Build Impact on Database Performance ------------------------------------------ Index Builds During Write-Heavy Workloads - Building indexes during time periods where the target collection - is under heavy write load can result in reduced write - performance and longer index builds. +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - Consider designating a maintenance window during which applications - stop or reduce write operations against the collection. Start the - index build during this maintenance window to mitigate the - potential negative impact of the build process. +Building indexes during time periods where the target collection +is under heavy write load can result in reduced write +performance and longer index builds. + +Consider designating a maintenance window during which applications +stop or reduce write operations against the collection. Start the +index build during this maintenance window to mitigate the +potential negative impact of the build process. Insufficient Available System Memory (RAM) - .. include:: /includes/fact-index-build-default-memory-limit.rst +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. include:: /includes/fact-index-build-default-memory-limit.rst - If the host machine has limited available free RAM, you may need - to schedule a maintenance period to increase the total system RAM - before you can modify the :binary:`~bin.mongod` RAM usage. +If the host machine has limited available free RAM, you may need +to schedule a maintenance period to increase the total system RAM +before you can modify the :binary:`~bin.mongod` RAM usage. .. _index-operations-replicated-build: .. _index-operations-simultaneous-build: @@ -190,21 +194,6 @@ The build process is summarized as follows: For sharded clusters, the index build occurs only on shards containing data for the collection being indexed. -.. warning:: - - Avoid dropping any index on a collection while an index is being - replicated on the secondaries. - - If you attempt to drop an index from a collection on a :term:`primary` - node while the collection has a background index building on the - :term:`secondary` nodes, the two indexing operations will conflict - with each other. - - As a result, reads will be halted across all namespaces and - replication will halt until the background index build completes. - When the build finishes the dropIndex action will execute, then - reads and replication will resume. - For a more detailed description of the index build process, see :ref:`index-build-process`. diff --git a/source/core/index-intersection.txt b/source/core/index-intersection.txt index 8c089e53bfa..bd2374da44a 100644 --- a/source/core/index-intersection.txt +++ b/source/core/index-intersection.txt @@ -133,15 +133,18 @@ For example, the ``orders`` collection has the following indexes: { status: 1 } { ord_date: -1 } -MongoDB cannot use index intersection for the following query with sort: +MongoDB cannot use index intersection for the following query because +the :method:`~cursor.sort()` requires an index separate from the query +predicate: .. code-block:: javascript db.orders.find( { qty: { $gt: 10 } } ).sort( { status: 1 } ) -That is, MongoDB does not use the ``{ qty: 1 }`` index for the query, -and the separate ``{ status: 1 }`` or the ``{ status: 1, ord_date: -1 -}`` index for the sort. +That is, MongoDB cannot use either of these index intersections: + +- ``{ qty: 1 }`` and ``{ status: 1 }`` +- ``{ qty: 1 }`` and ``{ status: 1, ord_date: -1 }`` However, MongoDB can use index intersection for the following query with sort since the index ``{ status: 1, ord_date: -1 }`` can fulfill diff --git a/source/core/index-multikey.txt b/source/core/index-multikey.txt index cbcce61869d..37e21debc21 100644 --- a/source/core/index-multikey.txt +++ b/source/core/index-multikey.txt @@ -210,6 +210,20 @@ $expr :query:`$expr` does not support multikey indexes. +Indexes Built on MongoDB 3.2 or Earlier +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Indexes built on MongoDB 3.2 or earlier do not contain the necessary +flags to support optimized multikey index use. To benefit from the +performance enhancements of multikey indexes, you must either: + +- Rebuild the older-format indexes on MongoDB 3.4 or later. See + :method:`db.collection.reIndex()`. + +- On a replica set, :doc:`resync the replica set members + ` containing older-format + indexes. + Examples -------- diff --git a/source/core/replica-set-oplog.txt b/source/core/replica-set-oplog.txt index f445bc38ef3..c0cf9dcee5d 100644 --- a/source/core/replica-set-oplog.txt +++ b/source/core/replica-set-oplog.txt @@ -257,3 +257,10 @@ the ``local.oplog.rs`` collection from a standalone MongoDB instance, and we recommend that you do not drop the collection from a standalone MongoDB v4.0 instance. The :ref:`mongod` requires the oplog for both :ref:`replication` and recovery of a node if the node goes down. + +Starting in MongoDB 4.4.2, it is no longer possible to perform manual +write operations to the :doc:`oplog ` on a +cluster running as a :ref:`replica set `. Performing write +operations to the oplog when running as a +:term:`standalone instance ` should only be done with +guidance from MongoDB Support. diff --git a/source/core/security-explicit-client-side-encryption.txt b/source/core/security-explicit-client-side-encryption.txt index 1eee2cf72e5..ce968efa4e4 100644 --- a/source/core/security-explicit-client-side-encryption.txt +++ b/source/core/security-explicit-client-side-encryption.txt @@ -93,12 +93,12 @@ implementing explicit client-side field level encryption. The MongoDB 4.2 :binary:`~bin.mongo` shell adds an additional option to the :method:`Mongo()` method for instantiating a database -connection with automatic client-side field level encryption. +connection with explicit client-side field level encryption. For a complete example, see :ref:`mongo-connection-client-side-encryption-enabled`. Applications must specify the following components when instantiating -the database connection to enable automatic client-side field level +the database connection to enable explicit client-side field level encryption: - A :ref:`key vault ` of data diff --git a/source/core/sharding-shard-key.txt b/source/core/sharding-shard-key.txt index 3598ebdfbe3..531b64c510f 100644 --- a/source/core/sharding-shard-key.txt +++ b/source/core/sharding-shard-key.txt @@ -213,7 +213,7 @@ the cluster. See also :ref:`sharding strategy `. At minimum, consider the consequences of the :ref:`cardinality`, :ref:`frequency`, and -rate of :ref:`change` of a potential shard key. +:ref:`monotonicity` of a potential shard key. .. note:: @@ -269,11 +269,12 @@ inserts may look similar to the following: The cluster in this example would *not* scale horizontally, as incoming writes would only route to a subset of shards. -A shard key with high cardinality does not guarantee even distribution of data -across the sharded cluster, though it does better facilitate horizontal -scaling. The :ref:`frequency ` and :ref:`rate of -change ` of the shard key also contributes to data -distribution. Consider each factor when choosing a shard key. +Choosing a shard key with high cardinality does not, on its own, +guarantee even distribution of data across the sharded cluster. The +:ref:`frequency ` and +:ref:`monotonicity ` of the shard key also +contribute to data distribution. Take each factor into account when +choosing a shard key. If your data model requires sharding on a key that has low cardinality, consider using a :term:`compound index` using a field that @@ -298,10 +299,12 @@ distribution of inserts may look similar to the following: .. include:: /images/sharded-cluster-ranged-distribution-frequency.rst -A shard key with low frequency does not guarantee even distribution of data -across the sharded cluster. The :ref:`cardinality ` and -:ref:`rate of change ` of the shard key also contributes -to data distribution. Consider each factor when choosing a shard key. +Choosing a shard key with low frequency does not, on its own, guarantee +even distribution of data across the sharded cluster. +The :ref:`cardinality ` and +:ref:`monotonicity ` of the shard key also +contribute to data distribution. Take each factor into account when +choosing a shard key. If your data model requires sharding on a key that has high frequency values, consider using a :term:`compound index` using a unique or @@ -309,8 +312,8 @@ low frequency value. .. _shard-key-monotonic: -Monotonically Changing Shard Keys -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Shard Key Monotonicity +~~~~~~~~~~~~~~~~~~~~~~ A shard key on a value that increases or decreases monotonically is more likely to distribute inserts to a single shard within the cluster. @@ -336,11 +339,12 @@ distribution of inserts may look similar to the following: If the shard key value was monotonically decreasing, then all inserts would route to ``Chunk A`` instead. -A shard key that does not change monotonically does not guarantee even -distribution of data across the sharded cluster. The -:ref:`cardinality` and -:ref:`frequency` of the shard key also contributes to -data distribution. Consider each factor when choosing a shard key. +Choosing a shard key that does not change monotonically does not, on +its own, guarantee even distribution of data across the sharded cluster. +The :ref:`cardinality` and +:ref:`frequency` of the shard key also contribute +to data distribution. Take each factor into account when choosing a +shard key. If your data model requires sharding on a key that changes monotonically, consider using :doc:`/core/hashed-sharding`. diff --git a/source/includes/4.4-downgrade-clean-shutdown.rst b/source/includes/4.4-downgrade-clean-shutdown.rst new file mode 100644 index 00000000000..38c74a8b77e --- /dev/null +++ b/source/includes/4.4-downgrade-clean-shutdown.rst @@ -0,0 +1,8 @@ +Run the following command from the :binary:`~bin.mongo` shell to +perform a clean shutdown, or refer to +:ref:`terminate-mongod-processes` for additional ways to safely +terminate the :binary:`~bin.mongod` process: + +.. code-block:: javascript + + db.adminCommand( { shutdown: 1 } ) diff --git a/source/includes/changelogs/releases/3.6.21.rst b/source/includes/changelogs/releases/3.6.21.rst index 48bcff8e4c0..bcac9190ca3 100644 --- a/source/includes/changelogs/releases/3.6.21.rst +++ b/source/includes/changelogs/releases/3.6.21.rst @@ -6,7 +6,8 @@ Sharding ~~~~~~~~ -:issue:`SERVER-51808` invariant failure: readConcern level != Available +- :issue:`SERVER-51808` invariant failure: readConcern level != Available +- :issue:`SERVER-51885` Blacklist balancing_sessions_collection.js from sharding_csrs_continuous_config_stepdown Replication ~~~~~~~~~~~ @@ -21,9 +22,8 @@ Replication Query ~~~~~ -- :issue:`SERVER-50291` Add query knob to enumerate $or children in a different order - :issue:`SERVER-51083` Problem with regex index bounds -- :issue:`SERVER-51120` Find queries with MERGE_SORT incorrectly sort the results when the collation is specified +- :issue:`SERVER-51120` Find queries with SORT_MERGE incorrectly sort the results when the collation is specified Storage ~~~~~~~ @@ -43,11 +43,13 @@ Build and Packaging Internals ~~~~~~~~~ -- :issue:`SERVER-41872` PlanEnumerator AndAssignment::choices ordering not stable and is relevant to set of plans generated +- :issue:`SERVER-45624` Pre-split and distribute chunks of sessions collection +- :issue:`SERVER-50123` Record number of physical cores on all platforms - :issue:`SERVER-50216` Adjust sys-perf frequencies - :issue:`SERVER-50605` Add {logMessage: "msg"} test-only command - :issue:`SERVER-50736` Make OpenSSL explicitly accept SNIs presented in ClientHello - :issue:`SERVER-50818` Coverity analysis defect 114987: Wrapper object use after free - :issue:`SERVER-51106` Make the isMaster command a derived class of hello +- :issue:`SERVER-51303` Lookup stage followed by $match on type uses wrong field in matching condition - :issue:`TOOLS-2590` [v3.6] sslAllowInvalidHostnames bypass ssl/tls server certification validation entirely diff --git a/source/includes/changelogs/releases/4.0.21.rst b/source/includes/changelogs/releases/4.0.21.rst index c2c598f2634..8ac89660c17 100644 --- a/source/includes/changelogs/releases/4.0.21.rst +++ b/source/includes/changelogs/releases/4.0.21.rst @@ -42,7 +42,8 @@ Query - :issue:`SERVER-39392` Invariant in PlanStage::dispose always evaluates as true - :issue:`SERVER-45233` Indexed inequalities to arrays return incorrect results - :issue:`SERVER-50291` Add query knob to enumerate $or children in a different order -- :issue:`SERVER-51120` Find queries with MERGE_SORT incorrectly sort the results when the collation is specified +- :issue:`SERVER-51083` Problem with regex index bounds +- :issue:`SERVER-51120` Find queries with SORT_MERGE incorrectly sort the results when the collation is specified Aggregation ~~~~~~~~~~~ @@ -86,6 +87,8 @@ Internals - :issue:`SERVER-50736` Make OpenSSL explicitly accept SNIs presented in ClientHello - :issue:`SERVER-50818` Coverity analysis defect 114987: Wrapper object use after free - :issue:`SERVER-51106` Make the isMaster command a derived class of hello +- :issue:`SERVER-51608` [4.0] backport implicitly_retry_on_background_op_in_progress.js +- :issue:`SERVER-51802` Add requires_majority_read_concern tag to decrypt_tool.js on v4.0 - :issue:`TOOLS-2589` [v4.0] sslAllowInvalidHostnames bypass ssl/tls server certification validation entirely - :issue:`WT-6421` Avoid parsing metadata checkpoint for clean files - :issue:`WT-6559` Use the session id from the new session to determine statistics bucket diff --git a/source/includes/changelogs/releases/4.0.22.rst b/source/includes/changelogs/releases/4.0.22.rst new file mode 100644 index 00000000000..fca0abd1aed --- /dev/null +++ b/source/includes/changelogs/releases/4.0.22.rst @@ -0,0 +1,81 @@ +.. _4.0.22-changelog: + +4.0.22 Changelog +---------------- + +Sharding +~~~~~~~~ + +- :issue:`SERVER-36739` Use the mongos_manual_intervention_action hook in concurrency stepdown suites +- :issue:`SERVER-41192` Add a metric for the size of the SessionCatalog under `logicalSessionRecordCache` +- :issue:`SERVER-42632` Disable pinger threads that reach out to config server to make integration tests pass +- :issue:`SERVER-46393` Always check client last operation time when computing operationTime to append to the response +- :issue:`SERVER-48679` flushRoutingTableCacheUpdates should block on critical section with kWrite, not kRead +- :issue:`SERVER-51808` invariant failure: readConcern level != Available +- :issue:`SERVER-51885` Blacklist balancing_sessions_collection.js from sharding_csrs_continuous_config_stepdown +- :issue:`SERVER-52955` KeysCollectionClientDirect should check if majority read concern is supported by storage engine + +Replication +~~~~~~~~~~~ + +- :issue:`SERVER-33747` Arbiter tries to start data replication if cannot find itself in config after restart +- :issue:`SERVER-50116` Forbid oplog writes when replication is enabled +- :issue:`SERVER-51262` Rename skipCheckingForNotMasterInCommandDispatch to skipCheckingForHelloInCommandDispatch +- :issue:`SERVER-51598` Add new test suites that test transaction expiration logic +- :issue:`SERVER-51887` "InvalidNamespace" in oplog tests on 4.0 branch +- :issue:`SERVER-52560` oplog_writes_only_permitted_on_standalone.js must wait for insert to be in stable checkpoint +- :issue:`SERVER-52680` Removed node on startup stuck in STARTUP2 after being re-added into the replica set +- :issue:`SERVER-53026` Secondary cannot restart replication + +Query +~~~~~ + +:issue:`SERVER-32960` $mod has inconsistent rounding/truncation behavior + +Aggregation +~~~~~~~~~~~ + +:issue:`SERVER-48523` Unconditionally check the first entry in the oplog when attempting to resume a change stream + +Storage +~~~~~~~ + +- :issue:`SERVER-51858` Investigate queryable issue on 4.0.20 +- :issue:`SERVER-52902` Remove assertion !haveJournalFiles() at dur_journal.cpp:265 + +Operations +~~~~~~~~~~ + +- :issue:`SERVER-46729` Make Windows shell soft-fail for unavailable OCSP responder +- :issue:`SERVER-51757` Collect /proc/vmstat numa_pages_migrated statistics in FTDC + +Build and Packaging +~~~~~~~~~~~~~~~~~~~ + +:issue:`SERVER-52891` Run PPC builds less frequently + +Internals +~~~~~~~~~ + +- :issue:`SERVER-45624` Pre-split and distribute chunks of sessions collection +- :issue:`SERVER-45992` InMemory engine startupwarnings confusing +- :issue:`SERVER-48742` Log whenever profiler settings are changed via setProfilingLevel +- :issue:`SERVER-49165` endSessions command in Client.Disconnect causes an authorization failure for an unauthed connection on a host that requires authentication +- :issue:`SERVER-50123` Record number of physical cores on all platforms +- :issue:`SERVER-50267` Set output limit for 'rawMongoProgramOutput()' +- :issue:`SERVER-50365` Stuck with long-running transactions that can't be timed out +- :issue:`SERVER-50445` Return the value as double when NumberLong subtraction overflows in ExpressionSubtract +- :issue:`SERVER-50605` Add {logMessage: "msg"} test-only command +- :issue:`SERVER-51303` Lookup stage followed by $match on type uses wrong field in matching condition +- :issue:`SERVER-51607` Upgrade Twisted dependency to at least twisted-19.7.0 +- :issue:`SERVER-51902` Check if storage engine supports Recover to Stable Timestamp rather than if eMRC=false in sync_tail.cpp +- :issue:`SERVER-52646` Validate and possibly fix edge cases in regex rewrite rules for userToDNMapping +- :issue:`SERVER-52654` new signing keys not generated by the monitoring-keys-for-HMAC thread +- :issue:`SERVER-52806` deb install files assume systemd +- :issue:`SERVER-52969` Disable Powercyle on non-master branches +- :issue:`SERVER-53233` Fix change_streams_update_lookup_shard_metadata_missing.js [4.2, 4.0] +- :issue:`SERVER-53348` Pin PyOpenSSL +- :issue:`WT-6507` Exit cache eviction worker after our operation has timed out +- :issue:`WT-6602` Allow operation timeout ms to be passed to commit and rollback +- :issue:`WT-6666` Start op timer when we configure it in rollback and commit + diff --git a/source/includes/changelogs/releases/4.2.11.rst b/source/includes/changelogs/releases/4.2.11.rst new file mode 100644 index 00000000000..f04ea06eeab --- /dev/null +++ b/source/includes/changelogs/releases/4.2.11.rst @@ -0,0 +1,88 @@ +.. _4.2.11-changelog: + +4.2.11 Changelog +---------------- + +Security +~~~~~~~~ + +:issue:`SERVER-45938` Allow matching O/OU/DC in client x509 cert if clusterMode:keyFile + +Sharding +~~~~~~~~ + +- :issue:`SERVER-36739` Use the mongos_manual_intervention_action hook in concurrency stepdown suites +- :issue:`SERVER-47616` Improve error when logical sessions cannot have more than one user authenticated on a single connection +- :issue:`SERVER-51808` invariant failure: readConcern level != Available + +Replication +~~~~~~~~~~~ + +- :issue:`SERVER-33747` Arbiter tries to start data replication if cannot find itself in config after restart +- :issue:`SERVER-50116` Forbid oplog writes when replication is enabled +- :issue:`SERVER-50415` Rename waitInIsMaster failpoint to waitInHello +- :issue:`SERVER-50527` Change NotMasterError category to NotPrimaryError + +Query +~~~~~ + +- :issue:`SERVER-51120` Find queries with SORT_MERGE incorrectly sort the results when the collation is specified +- :issue:`SERVER-51853` Always initialize the numInserted out-parameter in AbstractIndexAccessMethod::insertKeys + +Write Operations +~~~~~~~~~~~~~~~~ + +:issue:`SERVER-44586` add metrics to serverStatus to track type of update command + +Aggregation +~~~~~~~~~~~ + +:issue:`SERVER-48523` Unconditionally check the first entry in the oplog when attempting to resume a change stream + +Storage +~~~~~~~ + +:issue:`SERVER-43664` Speedup WiredTiger storage engine startup for many tables by optimizing WiredTigerUtil::setTableLogging() + +Operations +~~~~~~~~~~ + +- :issue:`SERVER-46729` Make Windows shell soft-fail for unavailable OCSP responder +- :issue:`SERVER-51757` Collect /proc/vmstat numa_pages_migrated statistics in FTDC + +Build and Packaging +~~~~~~~~~~~~~~~~~~~ + +- :issue:`SERVER-46342` DEB installs of MDB do not issue systemctl daemon-reload on install +- :issue:`SERVER-50016` Fail on missing variable customization files + +Internals +~~~~~~~~~ + +- :issue:`SERVER-43973` jsTestName() should return a unique name for each thread in the parallel suite +- :issue:`SERVER-45992` InMemory engine startupwarnings confusing +- :issue:`SERVER-46625` Improve diagnostics when mongocryptd requests are sent to non-mongocryptd daemon +- :issue:`SERVER-48078` Remove OpDebug invariant that relies on monotonic clock source +- :issue:`SERVER-48502` Tighten $currentOp and pinned cursor checks in kill_pinned_cursor.js +- :issue:`SERVER-49165` endSessions command in Client.Disconnect causes an authorization failure for an unauthed connection on a host that requires authentication +- :issue:`SERVER-49957` Read out of bounds in getPrevAndNextUUIDs +- :issue:`SERVER-50072` Check _isWindows() when initializing MongoRunner.EXIT_ABORT +- :issue:`SERVER-50123` Record number of physical cores on all platforms +- :issue:`SERVER-50216` Adjust sys-perf frequencies +- :issue:`SERVER-50365` Stuck with long-running transactions that can't be timed out +- :issue:`SERVER-50605` Add {logMessage: "msg"} test-only command +- :issue:`SERVER-50647` Fix OCSP HTTP Client timeout for Windows +- :issue:`SERVER-50736` Make OpenSSL explicitly accept SNIs presented in ClientHello +- :issue:`SERVER-50818` Coverity analysis defect 114987: Wrapper object use after free +- :issue:`SERVER-51004` Disable WT-Develop sys-perf build variants on sys-perf-4.2 +- :issue:`SERVER-51058` log_remote_op_wait.js misuses rawMongoProgramOutput +- :issue:`SERVER-51106` Make the isMaster command a derived class of hello +- :issue:`SERVER-51220` Handle auditing attribution in indirect drops +- :issue:`SERVER-51303` Lookup stage followed by $match on type uses wrong field in matching condition +- :issue:`SERVER-51840` Reduce dbtest jobs on 4.2 on Windows debug +- :issue:`TOOLS-2588` [v4.2] sslAllowInvalidHostnames bypass ssl/tls server certification validation entirely +- :issue:`WT-6160` Fix format failure caused by stack overwrite +- :issue:`WT-6507` Exit cache eviction worker after our operation has timed out +- :issue:`WT-6602` Allow operation timeout ms to be passed to commit and rollback +- :issue:`WT-6666` Start op timer when we configure it in rollback and commit + diff --git a/source/includes/changelogs/releases/4.2.12.rst b/source/includes/changelogs/releases/4.2.12.rst new file mode 100644 index 00000000000..84ef8d5e4fe --- /dev/null +++ b/source/includes/changelogs/releases/4.2.12.rst @@ -0,0 +1,84 @@ +.. _4.2.12-changelog: + +4.2.12 Changelog +---------------- + +Sharding +~~~~~~~~ + +- :issue:`SERVER-46393` Always check client last operation time when computing operationTime to append to the response +- :issue:`SERVER-50900` Disable PeriodicShardedIndexConsistencyChecker for cursor_valid_after_shard_stepdown.js +- :issue:`SERVER-52732` Uptime reporter disables autosplit during ShardingTest initialization +- :issue:`SERVER-53444` Make tests that run removeShard in assert.soon to wait for the state to become "completed" not error on ShardNotFound + +Replication +~~~~~~~~~~~ + +- :issue:`SERVER-49187` Make ReplSetTest .stepUp() robust to election failures. +- :issue:`SERVER-50049` assert.soonNoExcept() should not access TestData.traceExceptions for non-resmoke tests. +- :issue:`SERVER-50416` Change notMasterLegacyUnacknowledgedWrites to notPrimaryLegacyUnacknowledgedWrites in serverStatus +- :issue:`SERVER-50417` Change notMasterUnacknowledgedWrites to notPrimaryUnacknowledgedWrites in serverStatus +- :issue:`SERVER-50869` Background sync may erroneously set applied-through during step-up +- :issue:`SERVER-50901` RollbackTest should wait for secondaries before doing data consistency checks +- :issue:`SERVER-52560` oplog_writes_only_permitted_on_standalone.js must wait for insert to be in stable checkpoint +- :issue:`SERVER-52680` Removed node on startup stuck in STARTUP2 after being re-added into the replica set +- :issue:`SERVER-52744` rollback node's lastApplied > sync source's lastApplied in rollback_after_enabling_majority_reads.js +- :issue:`SERVER-53026` Secondary cannot restart replication +- :issue:`SERVER-53345` Excuse arbiter_new_hostname.js from multiversion tests + +Query +~~~~~ + +- :issue:`SERVER-32960` $mod has inconsistent rounding/truncation behavior +- :issue:`SERVER-40361` Reduce memory footprint of plan cache entries +- :issue:`SERVER-50769` server restarted after expr:{"expr":"_currentApplyOps.getArrayLength() > 0","file":"src/mongo/db/pipeline/document_source_change_stream_transform.cpp","line":535}} + +Aggregation +~~~~~~~~~~~ + +- :issue:`SERVER-34741` Move $match in front of $group if condition is on group key +- :issue:`SERVER-40090` DISTINCT_SCAN in agg is only used when certain format of _id is specified +- :issue:`SERVER-51886` $lookup + $merge pipeline may fail to resolve views correctly when collection names collide + +Storage +~~~~~~~ + +- :issue:`SERVER-47812` Secondaries persist wildcard multikeypaths out of order +- :issue:`SERVER-48471` Hashed indexes may be incorrectly marked multikey and be ineligible as a shard key +- :issue:`SERVER-51858` Investigate queryable issue on 4.0.20 +- :issue:`SERVER-52950` recoverOplogAsStandalone mode must not start oplog truncater thread +- :issue:`SERVER-53703` [4.2] Opening a transaction at the all durable timestamp can go backwards + +Build and Packaging +~~~~~~~~~~~~~~~~~~~ + +:issue:`SERVER-52891` Run PPC builds less frequently + +Internals +~~~~~~~~~ + +- :issue:`SERVER-41836` Log thread Id as part of error in FSM tests +- :issue:`SERVER-43739` SNI name is not set on OSX if allowInvalidHostnames is enabled +- :issue:`SERVER-44375` fix merge_with_drop_shard.js when the curop command fails due to ShardNotFound +- :issue:`SERVER-47863` Initial Sync Progress Metrics +- :issue:`SERVER-48742` Log whenever profiler settings are changed via setProfilingLevel +- :issue:`SERVER-50267` Set output limit for 'rawMongoProgramOutput()' +- :issue:`SERVER-50445` Return the value as double when NumberLong subtraction overflows in ExpressionSubtract +- :issue:`SERVER-51526` Hybrid index builds can miss writes and crash in the event of a well-timed WriteConflictException +- :issue:`SERVER-51607` Upgrade Twisted dependency to at least twisted-19.7.0 +- :issue:`SERVER-52618` Sparse hash index should not be used for equality to null match +- :issue:`SERVER-52646` Validate and possibly fix edge cases in regex rewrite rules for userToDNMapping +- :issue:`SERVER-52654` new signing keys not generated by the monitoring-keys-for-HMAC thread +- :issue:`SERVER-52806` deb install files assume systemd +- :issue:`SERVER-52879` Periodic operation latency spikes every 5 minutes due to closing idle cached WT sessions +- :issue:`SERVER-52919` Wire compression not enabled for initial sync +- :issue:`SERVER-52929` Correctly handle compound indexes with 32 keys +- :issue:`SERVER-52969` Disable Powercyle on non-master branches +- :issue:`SERVER-52975` Fix use of 'onRollback' callback for collection validator options in 'collection_impl.cpp' +- :issue:`SERVER-53233` Fix change_streams_update_lookup_shard_metadata_missing.js [4.2, 4.0] +- :issue:`SERVER-53234` jstests/core/profile2.js fails when background operations are run against test database +- :issue:`WT-6835` Add API to allow consolidating incremental backup info +- :issue:`WT-6839` Add API to query existing incremental backup IDs +- :issue:`WT-6882` Files created during incremental backup should be copied in full +- :issue:`WT-6922` Add random consolidate testing to incr_backup + diff --git a/source/includes/changelogs/releases/4.4.2.rst b/source/includes/changelogs/releases/4.4.2.rst index 865de9b3331..ad926846c36 100644 --- a/source/includes/changelogs/releases/4.4.2.rst +++ b/source/includes/changelogs/releases/4.4.2.rst @@ -15,6 +15,7 @@ Security Sharding ~~~~~~~~ +- :issue:`SERVER-36739` Use the mongos_manual_intervention_action hook in concurrency stepdown suites - :issue:`SERVER-47616` Improve error when logical sessions cannot have more than one user authenticated on a single connection - :issue:`SERVER-48504` Combination of StaleShardVersion and ShardNotFound exception make the ChunkManagerTargeter crash - :issue:`SERVER-48566` Shard loader in primary nodes blindly read the version of config.cache.collections @@ -41,6 +42,7 @@ Replication - :issue:`SERVER-49987` Rename response fields if “hello” is sent on mongod - :issue:`SERVER-49988` Rename response fields if "hello" is sent on mongos - :issue:`SERVER-49989` Add db.hello() shell helper +- :issue:`SERVER-50083` reconfig kill primary and stepdown passthroughs should disable election handoff - :issue:`SERVER-50097` inaccurate exhaustIsMasterMetrics if an isMaster command alias is used - :issue:`SERVER-50103` DBClientCursor doesn't set a socket timeout when using a side connection to send the kill cursor request - :issue:`SERVER-50116` Forbid oplog writes when replication is enabled @@ -61,6 +63,8 @@ Replication - :issue:`SERVER-50869` Background sync may erroneously set applied-through during step-up - :issue:`SERVER-51047` standalone_replication_recovery_relaxes_index_constaints.js should not run in replica_sets_multiversion in 4.4 - :issue:`SERVER-51163` Mark nodes returning InvalidReplicaSetConfig in heartbeats as down +- :issue:`SERVER-51259` Rename waitForIsMasterResponse to waitForHelloResponse +- :issue:`SERVER-51260` Rename hangWhileWaitingForIsMasterResponse to hangWhileWaitingForHelloResponse - :issue:`SERVER-51597` Don't try to cleanly shut down initial syncer when config changes - :issue:`SERVER-51726` Maintain status code compatibility when main executor is shut down @@ -73,7 +77,7 @@ Query - :issue:`SERVER-50028` Coverity analysis defect 114771: Dereference after null check - :issue:`SERVER-50029` Coverity analysis defect 115663: Uninitialized scalar variable - :issue:`SERVER-50291` Add query knob to enumerate $or children in a different order -- :issue:`SERVER-51120` Find queries with MERGE_SORT incorrectly sort the results when the collation is specified +- :issue:`SERVER-51120` Find queries with SORT_MERGE incorrectly sort the results when the collation is specified - :issue:`SERVER-51853` Always initialize the numInserted out-parameter in AbstractIndexAccessMethod::insertKeys Write Operations @@ -104,7 +108,7 @@ Storage - :issue:`SERVER-47803` Move the database level profile setting from Database into CollectionCatalog - :issue:`SERVER-47812` Secondaries persist wildcard multikeypaths out of order - :issue:`SERVER-47959` Retry JournalFlusher oplog reads on WriteConflictExceptions caused by concurrent {full:true} validate command on the oplog collection -- :issue:`SERVER-48021` Add WT debug table logging mode to *kill_(primary|secondary)* tests +- :issue:`SERVER-48021` Add WT debug table logging mode to ``*kill_(primary|secondary)*`` tests - :issue:`SERVER-48154` ident dropper should periodically yield Global IS lock - :issue:`SERVER-48245` index drop allowed on drop-pending collection - :issue:`SERVER-49776` Forward port MDB <-> WT versioning table from 4.2 to 4.4 and master, please @@ -153,6 +157,7 @@ Internals - :issue:`SERVER-46798` remove VersionInfoInterface::isSameMajorVersion - :issue:`SERVER-47375` Complete TODO listed in SERVER-45798 - :issue:`SERVER-47827` Request for a local burn_in_tests.py that locally runs all tests changed since master, including those committed in the local branch +- :issue:`SERVER-48030` Fix deadlock with GetShardMap and old RSM - :issue:`SERVER-48067` Reduce memory consumption for unique index builds with large numbers of non-unique keys - :issue:`SERVER-48170` Multiversion tests assume primary stability when using upgradeCluster() with 2-node replica set shards - :issue:`SERVER-48324` Expose parameter to include tcmalloc verbose statistics in ftdc @@ -179,13 +184,14 @@ Internals - :issue:`SERVER-50072` Check _isWindows() when initializing MongoRunner.EXIT_ABORT - :issue:`SERVER-50123` Record number of physical cores on all platforms - :issue:`SERVER-50134` Run microbenchmarks tests through DSI +- :issue:`SERVER-50148` Fix use-after-move in MultiIndexBlock - :issue:`SERVER-50242` slow query message seen in mongos for ismaster - :issue:`SERVER-50246` $unionWith explain loses information from any stages in sub-pipeline which get absorbed into cursor stage - :issue:`SERVER-50249` Upgrade via package manager from 4.2.8 to 4.4.0 - :issue:`SERVER-50326` Restrict sharding in agg_out.js workload to a single thread - :issue:`SERVER-50365` Stuck with long-running transactions that can't be timed out - :issue:`SERVER-50376` Ninja next does not see compiler changes -- :issue:`SERVER-50379` Reduce frequency of ! and * builders on 4.4 +- :issue:`SERVER-50379` Reduce frequency of ``!`` and ``*`` builders on 4.4 - :issue:`SERVER-50394` mongod audit log attributes DDL operations to the __system user in a sharded environment - :issue:`SERVER-50401` Handle patches applied as commits - :issue:`SERVER-50490` Reduce log severity of SERVER RESTARTED from Warning(-2) back to Log(0) @@ -202,15 +208,22 @@ Internals - :issue:`SERVER-50955` oplog_rollover.js pauses the OplogCapMaintainerThread until truncation is needed - :issue:`SERVER-51041` Throttle starting transactions for secondary reads - :issue:`SERVER-51045` [v4.4] Update blocklist pending 4.2 backport for SERVER-46625 +- :issue:`SERVER-51097` unittests ran for more than an hour, stalling the commit queue - :issue:`SERVER-51106` Make the isMaster command a derived class of hello - :issue:`SERVER-51194` Make evergreen tasks for build-tools next - :issue:`SERVER-51220` Handle auditing attribution in indirect drops - :issue:`SERVER-51242` Disable canaries in microbenchmarks DSI tasks +- :issue:`SERVER-51303` Lookup stage followed by $match on type uses wrong field in matching condition - :issue:`SERVER-51384` Enable and Fix Compile for Drivers Nightly Testing 4.4 - :issue:`SERVER-51467` Set waitUntilStable to true when upgrading clusters in change_streams_multiversion_cluster.js - :issue:`SERVER-51604` Evergreen compile task should fail if debug symbols upload fails +- :issue:`SERVER-51607` Upgrade Twisted dependency to at least twisted-19.7.0 - :issue:`SERVER-51685` Fix download of MongoDB 4.4.1 for multiversion testing on the 4.4 branch - :issue:`SERVER-51771` libunwind fails to build with GCC >=10.2 +- :issue:`SERVER-52617` Cache the pointer to the oplog collection before running recoverToOplogTimestamp +- :issue:`SERVER-52696` Add sysbench to system_perf.yml modules +- :issue:`SERVER-52697` Add tpcc to system_perf.yml modules +- :issue:`WT-4310` Add option to not abort in diagnostic builds on data corruption - :issue:`WT-5144` Use wt_clock instead of wt_epoch in perf programs - :issue:`WT-5585` Remove cache_overflow config option - :issue:`WT-5645` Add Evergreen test that cycles through known failure test/format configs @@ -246,4 +259,78 @@ Internals - :issue:`WT-6560` Fix usage of global salvage in WT utility - :issue:`WT-6561` Provide MongoDB configuration in the wt utility usage output - :issue:`WT-6569` Squash the prepared updates into a single update before writing it to data store +- :issue:`WT-6570` RTS to remove the left over updates in the history store without stop timestamp +- :issue:`WT-6571` Lseek cannot use error_sys_check because it does not return an int +- :issue:`WT-6577` History store dump outputs confusing time window +- :issue:`WT-6581` Fix class name in test_hs15 +- :issue:`WT-6583` Only clear the read timestamp when releasing the transaction +- :issue:`WT-6586` Tombstone inserted to history store should also be flagged as WT_UPDATE_HS +- :issue:`WT-6589` Fix disabled cursor cache python tests +- :issue:`WT-6591` Stop checkpoint thread before closing connection in Python tests +- :issue:`WT-6592` Avoid marking errors for skipped Python tests due to not-built extension +- :issue:`WT-6593` Retry conflicting operations in test_rollback_to_stable10 +- :issue:`WT-6596` Increase cache for timestamp abort test and separate key spaces for all abort tests +- :issue:`WT-6598` Add new API allowing changing dhandle hash bucket size +- :issue:`WT-6602` Allow operation timeout ms to be passed to commit and rollback +- :issue:`WT-6604` Fix typo in the comment descibing WT_CELL structure +- :issue:`WT-6610` Fix incremental backup checkpoint parsing to handle upgrades +- :issue:`WT-6612` Increase cache size in test_prepare08 to fix rollback error due to cache pressure +- :issue:`WT-6613` Add python test for early_load flag +- :issue:`WT-6615` Initialize last_upd where it is actually used +- :issue:`WT-6616` Set the oldest timestamp of the checkpoint when it is finished +- :issue:`WT-6619` Eliminate possibility of infinite loop in test_cursor13.py +- :issue:`WT-6624` Use transaction snapshot for applications performing eviction +- :issue:`WT-6625` Remove outdated TODO +- :issue:`WT-6629` Support index tables in metadata:create cursors +- :issue:`WT-6635` Disable mix and column filetype test +- :issue:`WT-6640` Coverity: Failure to restore saved dhandle +- :issue:`WT-6641` Coverity: Unused value +- :issue:`WT-6643` Explicitly set the 64-bit uint part of the LSN for atomic assignment +- :issue:`WT-6649` Coverity: Unintentional integer overflow in __wt_rec_need_split +- :issue:`WT-6650` Coverity: Null dereferences in session::close +- :issue:`WT-6653` Rollback/Restart txn before retry in RTS test +- :issue:`WT-6654` Clean up test_backup15.py +- :issue:`WT-6657` Fix history store panic when inserting an update without timestamp +- :issue:`WT-6666` Start op timer when we configure it in rollback and commit +- :issue:`WT-6670` Fix uninitialized buffer +- :issue:`WT-6671` Save the checkpoint snapshot that is used to take checkpoint in the metadata +- :issue:`WT-6674` Remove Async API code and documentation +- :issue:`WT-6675` Remove WiredTiger Java language API and documentation +- :issue:`WT-6680` Temporarily disable history store verification +- :issue:`WT-6683` Fix logically dead code +- :issue:`WT-6685` Add import configuration option to WT_SESSION::create +- :issue:`WT-6689` Add support for file import when the exported configuration is provided +- :issue:`WT-6690` Add support for table import when the exported configuration is provided +- :issue:`WT-6691` Add file import repair functionality +- :issue:`WT-6692` Handle scenario where imported timestamps are newer than current DB's timestamps +- :issue:`WT-6708` Repurpose oldest start txn to be newest txn in the aggregated time window +- :issue:`WT-6712` Allow RTS to operate when stable timestamp is not set +- :issue:`WT-6720` Add new hs open() and close() methods +- :issue:`WT-6725` Skip checking visibility for updates restored from disk +- :issue:`WT-6731` Prevent WT_RESTART from being returned to API calls +- :issue:`WT-6732` Fix post-task command noises in Evergreen task logs +- :issue:`WT-6734` Add missing brace to Swig Java interface +- :issue:`WT-6736` Add statistics to track evictions in parallel with checkpoint +- :issue:`WT-6741` Add check for supported data source on import +- :issue:`WT-6746` Save base write gen in metadata during checkpoint +- :issue:`WT-6756` Rearrange top level of documentation +- :issue:`WT-6761` Ignore stdout for test_rollback_to_stable10 +- :issue:`WT-6762` Use stats instead of files to check consumption +- :issue:`WT-6763` Fix freeing update on the chain when insert fail after inserting to the update chain +- :issue:`WT-6764` Wait for stable timestamp to move before publishing checkpoint information in timestamp abort test +- :issue:`WT-6765` Add more debugging and earlier detection of missing file +- :issue:`WT-6767` Adding a new read timestamp config that allows it to be set older than the oldest timestamp +- :issue:`WT-6783` Generate unique keys for table to ensure log records +- :issue:`WT-6792` Update compatibility tests to test against mongodb-5.0 branch +- :issue:`WT-6793` Organize code statistics Evergreen tasks +- :issue:`WT-6797` Ensure minimum entries before short-circuiting +- :issue:`WT-6798` Utilize Arm LSE atomics and the correct strength barriers +- :issue:`WT-6806` Back off aggressive abort in random_directio +- :issue:`WT-6808` Documentation: add top level architecture picture +- :issue:`WT-6809` Avoid deadlock by moving hs cursor caching earlier +- :issue:`WT-6811` Allow older readers to read behind a mixed-mode operation +- :issue:`WT-6812` Fix "out-of-order fixup" potentially corrupting historical values +- :issue:`WT-6813` Fix memory leak in schema_create +- :issue:`WT-6822` Use the correct python for all tests and set up env for the split stress test +- :issue:`WT-6827` Run scons check examples in sequence not parallel diff --git a/source/includes/changelogs/releases/4.4.3.rst b/source/includes/changelogs/releases/4.4.3.rst new file mode 100644 index 00000000000..f4217b90fac --- /dev/null +++ b/source/includes/changelogs/releases/4.4.3.rst @@ -0,0 +1,157 @@ +.. _4.4.3-changelog: + +4.4.3 Changelog +--------------- + +Sharding +~~~~~~~~ + +- :issue:`SERVER-48261` Unblacklist auth tests that use the 'mixedShardTest' helper +- :issue:`SERVER-48571` Write operation might invariant if a target error and a response error is received +- :issue:`SERVER-51834` Race in moveChunk tests +- :issue:`SERVER-52686` Blacklist transactions_causal_consistency.js test from the sharding_csrs_continuous_config_stepdown +- :issue:`SERVER-53029` Port the changes for SERVER-52955 to later branches + +Replication +~~~~~~~~~~~ + +- :issue:`SERVER-33747` Arbiter tries to start data replication if cannot find itself in config after restart +- :issue:`SERVER-49159` Return NotPrimaryOrSecondary if currentTime is uninitialized in waitForReadConcernImpl +- :issue:`SERVER-49187` Make ReplSetTest .stepUp() robust to election failures. +- :issue:`SERVER-50049` assert.soonNoExcept() should not access TestData.traceExceptions for non-resmoke tests. +- :issue:`SERVER-50416` Change notMasterLegacyUnacknowledgedWrites to notPrimaryLegacyUnacknowledgedWrites in serverStatus +- :issue:`SERVER-50417` Change notMasterUnacknowledgedWrites to notPrimaryUnacknowledgedWrites in serverStatus +- :issue:`SERVER-50901` RollbackTest should wait for secondaries before doing data consistency checks +- :issue:`SERVER-51261` Rename hangWaitingForIsMasterResponseOnStandalone to hangWaitingForHelloResponseOnStandalone +- :issue:`SERVER-51262` Rename skipCheckingForNotMasterInCommandDispatch to skipCheckingForHelloInCommandDispatch +- :issue:`SERVER-51333` setFeatureCompatibilityVersion should fail when downgrading from FCV 4.4 to FCV 4.2 with long collection names present +- :issue:`SERVER-52560` oplog_writes_only_permitted_on_standalone.js must wait for insert to be in stable checkpoint +- :issue:`SERVER-52680` Removed node on startup stuck in STARTUP2 after being re-added into the replica set +- :issue:`SERVER-53197` Awaitable hello/isMaster appears in slow query log, part 2 + +Query +~~~~~ + +- :issue:`SERVER-32960` $mod has inconsistent rounding/truncation behavior +- :issue:`SERVER-40361` Reduce memory footprint of plan cache entries +- :issue:`SERVER-48529` Delete unused PlanCache::feedback() mechanism +- :issue:`SERVER-49744` Per-document scoring metadata for $search +- :issue:`SERVER-49810` Stable result comparison for facet/use_cases.js +- :issue:`SERVER-52589` Index key consistency check during FETCH may fail in certain cases + +Aggregation +~~~~~~~~~~~ + +:issue:`SERVER-33966` redundant $sort in aggregation prevents best $limit $sort consolidation + +Storage +~~~~~~~ + +- :issue:`SERVER-50502` The lock manager dump logv2 message needs logv2::LogTruncation::Disabled set so that lock dumps are not truncated +- :issue:`SERVER-51122` [v4.4] The snapshot window code must use TestingProctor consistently and not getTestCommandsEnabled +- :issue:`SERVER-51858` Investigate queryable issue on 4.0.20 +- :issue:`SERVER-52950` recoverOplogAsStandalone mode must not start oplog truncater thread + +Operations +~~~~~~~~~~ + +- :issue:`SERVER-48221` Shut down ftdc after storage engine +- :issue:`SERVER-51603` add log message for failing validation via exception path +- :issue:`SERVER-51652` add better error handling for validate's use of KeyString +- :issue:`SERVER-51757` Collect /proc/vmstat numa_pages_migrated statistics in FTDC +- :issue:`SERVER-51829` always show index-level corruption reasons in validate output + +Build and Packaging +~~~~~~~~~~~~~~~~~~~ + +- :issue:`SERVER-41262` Decouple compile_all from compile_all_run_unittests_TG to reduce makespan +- :issue:`SERVER-52580` Windows mh artifacts missing from 4.4 branch +- :issue:`SERVER-52891` Run PPC builds less frequently + +Internals +~~~~~~~~~ + +- :issue:`SERVER-47863` Initial Sync Progress Metrics +- :issue:`SERVER-49232` Confusing log message when fail point is activated +- :issue:`SERVER-50267` Set output limit for 'rawMongoProgramOutput()' +- :issue:`SERVER-50271` Remove --logv2 from shell +- :issue:`SERVER-50445` Return the value as double when NumberLong subtraction overflows in ExpressionSubtract +- :issue:`SERVER-50547` Explore aggregation pipeline length limit +- :issue:`SERVER-51057` Test that getMore metrics are incremented in server_status_metrics.js +- :issue:`SERVER-51164` Remove non-DSI Microbenchmarks +- :issue:`SERVER-51405` Disable some concurrency suites for ephemeralForTest on v4.4 +- :issue:`SERVER-51418` Resolve race condition in StepdownShouldInterruptConfigWrite +- :issue:`SERVER-51454` operationProfiling.filter config option rejects agg expressions +- :issue:`SERVER-51526` Hybrid index builds can miss writes and crash in the event of a well-timed WriteConflictException +- :issue:`SERVER-51715` Wrap timestamps with tojson() in log lines in optime.js +- :issue:`SERVER-51718` Disallow sparse, hashed indexes from being considered for answering $exists: false queries. +- :issue:`SERVER-51733` config server in a docker container fails to start up with authentication +- :issue:`SERVER-51793` Speed up compile tasks generated by burn_in_tags by running them on rhel62-large +- :issue:`SERVER-51796` Missing comma in "Restoring orphaned data file" (22334) log message parameters +- :issue:`SERVER-51797` Add task_path_suffix to evergreen.yml +- :issue:`SERVER-51818` add name to invariant message in Mutex destructor +- :issue:`SERVER-52586` Disable refine_shard_key_transaction_stress task in sys-perf +- :issue:`SERVER-52625` linkbenches write to conventional location +- :issue:`SERVER-52646` Validate and possibly fix edge cases in regex rewrite rules for userToDNMapping +- :issue:`SERVER-52654` new signing keys not generated by the monitoring-keys-for-HMAC thread +- :issue:`SERVER-52666` ycsb is a module and writes to a convenitional location +- :issue:`SERVER-52740` Introduce rhel62-medium distro for non compile tasks with large memory footprint +- :issue:`SERVER-52746` Ensure tailable cursor in find_cmd.js is invalidated +- :issue:`SERVER-52775` Fix sys-perf module issues +- :issue:`SERVER-52806` deb install files assume systemd +- :issue:`SERVER-52824` Support AWS roles with paths +- :issue:`SERVER-52834` Migrate sys-perf and perf tasks to use the new run_workload DSI command +- :issue:`SERVER-52929` Correctly handle compound indexes with 32 keys +- :issue:`SERVER-52969` Disable Powercyle on non-master branches +- :issue:`SERVER-52975` Fix use of 'onRollback' callback for collection validator options in 'collection_impl.cpp' +- :issue:`SERVER-53017` replSetGetStatus remainingInitialSyncEstimatedMillis always 0 +- :issue:`SERVER-53058` Better account of CleanEveryN runtime when setting dynamic timeouts +- :issue:`SERVER-53068` Use 10gen/linkbench2 instead of mdcallag/linkbench for system perf +- :issue:`SERVER-53196` Fail to generate tasks if a large distro is specified but not available +- :issue:`SERVER-53314` Generated tasks can specify a null distro +- :issue:`WT-4780` Enable assertion that commit timestamp is newer than all readers +- :issue:`WT-6449` Hang analyzer for WT Evergreen tests +- :issue:`WT-6563` Create a reproducer for invalid modification application +- :issue:`WT-6678` Remove Huffman Encoding support for Keys +- :issue:`WT-6693` Add compatibility testing for imported objects +- :issue:`WT-6706` Add table import repair functionality +- :issue:`WT-6713` Remove transaction support from custom data sources +- :issue:`WT-6722` Review function names in history store module +- :issue:`WT-6750` Assert to ensure no duplicate entries in the history store +- :issue:`WT-6751` Assert if new value is the same as old value for a history store update +- :issue:`WT-6752` Assert history store will not have any uncommitted updates +- :issue:`WT-6753` Assert only stop time pair of history store update can be modified. +- :issue:`WT-6816` Design write gen scheme to allow dhandles with active history to get closed/re-opened +- :issue:`WT-6824` Fix OSX python test errors related to UTF encoding +- :issue:`WT-6828` Fix doc link in README +- :issue:`WT-6830` Encode bytes before concatenating with string +- :issue:`WT-6835` Add API to allow consolidating incremental backup info +- :issue:`WT-6836` Handle the last key in the shadow table being removed by rollback to stable in timestamp abort +- :issue:`WT-6839` Add API to query existing incremental backup IDs +- :issue:`WT-6842` Add example showing using src_id only +- :issue:`WT-6844` Make force stop durable +- :issue:`WT-6845` Set session btree to HS when operating on history store +- :issue:`WT-6857` Define a new cursor for the history store access. +- :issue:`WT-6858` Implement insert method for the history store cursor +- :issue:`WT-6859` Implement search_near method for the history store cursor +- :issue:`WT-6860` Add relevant history store statistics to data handles +- :issue:`WT-6867` Documentation: create model subpages for architecture guide +- :issue:`WT-6868` Don't cache history store cursor for operations on metadata +- :issue:`WT-6869` Assert tree walk never return the start ref +- :issue:`WT-6870` Rename history store statistic to better describe its use case. +- :issue:`WT-6872` Replace the yield instructions with an ISB +- :issue:`WT-6875` Remove legacy import invocation +- :issue:`WT-6882` Files created during incremental backup should be copied in full +- :issue:`WT-6883` Redo change for breaking up backup ranges and fix for EOF +- :issue:`WT-6894` Implement history store cursor prev and next methods +- :issue:`WT-6895` Implement HS cursor update method +- :issue:`WT-6896` Initial implementation of hs cursor remove +- :issue:`WT-6916` Create stub subpages for architecture guide +- :issue:`WT-6922` Add random consolidate testing to incr_backup +- :issue:`WT-6925` Fix incorrect comment +- :issue:`WT-6934` Fix __wt_hs_upd_find wrongly returns WT_NOTFOUND +- :issue:`WT-6957` Reposition the cursor if __wt_hs_modify return WT_RESTART +- :issue:`WT-6958` Fix history store cursor position after operations +- :issue:`WT-6961` RTS no stable timestamp +- :issue:`WT-6986` Add UndoDB support to format.sh + diff --git a/source/includes/extracts-4.2-downgrade-fcv.yaml b/source/includes/extracts-4.2-downgrade-fcv.yaml index fd65e64caa1..dc705384320 100644 --- a/source/includes/extracts-4.2-downgrade-fcv.yaml +++ b/source/includes/extracts-4.2-downgrade-fcv.yaml @@ -77,6 +77,25 @@ content: | }); }); --- +ref: 4.2-downgrade-fcv-system-unique-index +content: | + + In addition, if you have enabled :doc:`access control + `, you must also remove the system + unique index ``user_1_db_1`` on the ``admin.system.users`` + collection. + + If fCV has ever been set to ``"4.2"``, use the following command to + drop the ``user_1_db_1`` system unique index: + + .. code-block:: javascript + + db.getSiblingDB("admin").getCollection("system.users").dropIndex("user_1_db_1") + + The ``user_1_db_1`` index will automatically be rebuilt when starting + the server with the 4.0 binary in the procedure below. + +--- ref: 4.2-downgrade-fcv-unique-index-access-control-sharded-cluster content: | diff --git a/source/includes/extracts-agg-operators.yaml b/source/includes/extracts-agg-operators.yaml index 846bce4eeef..b4531152ea8 100644 --- a/source/includes/extracts-agg-operators.yaml +++ b/source/includes/extracts-agg-operators.yaml @@ -46,6 +46,18 @@ content: | - Returns the inverse hyperbolic tangent (hyperbolic arc tangent) of a value in radians. + * - :expression:`$sinh` + - Returns the hyperbolic sine of a value that is measured in + radians. + + * - :expression:`$cosh` + - Returns the hyperbolic cosine of a value that is measured in + radians. + + * - :expression:`$tanh` + - Returns the hyperbolic tangent of a value that is measured in + radians. + * - :expression:`$degreesToRadians` - Converts a value from degrees to radians. @@ -478,6 +490,31 @@ content: | specify the date argument first as it is not meaningful to subtract a date from a number. +--- +ref: agg-operators-miscellaneous +content: | + + .. list-table:: + :header-rows: 1 + :widths: 20 80 + + * - Name + - Description + + * - :expression:`$rand` + - Returns a random float between 0 and 1 + + .. versionadded:: 4.4.2 + + * - :expression:`$sampleRate` + + - Randomly select documents at a given rate. Although the exact + number of documents selected varies on each run, the quantity + chosen approximates the sample rate expressed as a percentage + of the total number of documents. + + .. versionadded:: 4.4.2 + --- ref: agg-operators-objects content: | @@ -768,6 +805,7 @@ content: | aggregation pipeline may interpret as an expression. For example, use a :expression:`$literal` expression to a string that starts with a ``$`` to avoid parsing as a field path. + --- ref: agg-operators-custom-aggregation content: | diff --git a/source/includes/extracts-parameter-upsert.yaml b/source/includes/extracts-parameter-upsert.yaml index 06ac9401624..f431ccbf86f 100644 --- a/source/includes/extracts-parameter-upsert.yaml +++ b/source/includes/extracts-parameter-upsert.yaml @@ -23,7 +23,7 @@ source: replacement: upsertMethod: ":method:`~db.collection.findAndModify()`" queryOrFilter: query - conjunction: "Used in conjuction with the ``update`` field. + conjunction: "Used in conjunction with the ``update`` field. " diff --git a/source/includes/extracts-server-status-projection-base.yaml b/source/includes/extracts-server-status-projection-base.yaml index aae7dc11d22..855bfdf48d8 100644 --- a/source/includes/extracts-server-status-projection-base.yaml +++ b/source/includes/extracts-server-status-projection-base.yaml @@ -15,7 +15,15 @@ content: | ref: _serverStatus-output-changes content: | - - Starting in MongoDB 5.0, {{operationName}}: + - Starting in MongoDB 4.4.3, {{operationName}}: + + - Changed ``notMasterLegacyUnacknowledgedWrites`` to + :serverstatus:`~metrics.repl.network.notPrimaryLegacyUnacknowledgedWrites` + + - Changed ``notMasterUnacknowledgedWrites`` to + :serverstatus:`~metrics.repl.network.notPrimaryUnacknowledgedWrites` + + - Starting in MongoDB 4.4.2, {{operationName}}: - Added new metrics to track use of Aggregation Pipeline methods: diff --git a/source/includes/fact-4.4-stapling-refresh-rename.rst b/source/includes/fact-4.4-stapling-refresh-rename.rst new file mode 100644 index 00000000000..b487b8e23b1 --- /dev/null +++ b/source/includes/fact-4.4-stapling-refresh-rename.rst @@ -0,0 +1,2 @@ +Renamed from ``ocspValidationRefreshPeriodSecs`` to +``ocspStaplingRefreshPeriodSecs`` in MongoDB 4.4.1. diff --git a/source/includes/fact-check-amazon-linux-community.rst b/source/includes/fact-check-amazon-linux-community.rst index d72aad9a50f..21112f3c351 100644 --- a/source/includes/fact-check-amazon-linux-community.rst +++ b/source/includes/fact-check-amazon-linux-community.rst @@ -5,7 +5,7 @@ following command on the command-line: grep ^NAME /etc/*release -The result should be **Amazon Linux**. If using a different Linux -distribution, please see the +The result should be **Amazon Linux** or **Amazon Linux AMI**. If using +a different Linux distribution, please see the :doc:`install instructions for your platform `. diff --git a/source/includes/fact-check-amazon-linux-enterprise.rst b/source/includes/fact-check-amazon-linux-enterprise.rst index f254842c9cd..511f08c6a54 100644 --- a/source/includes/fact-check-amazon-linux-enterprise.rst +++ b/source/includes/fact-check-amazon-linux-enterprise.rst @@ -5,7 +5,7 @@ following command on the command-line: grep ^NAME /etc/*release -The result should be **Amazon Linux**. If using a different Linux -distribution, please see the +The result should be **Amazon Linux** or **Amazon Linux AMI**. If using +a different Linux distribution, please see the :doc:`install instructions for your platform `. diff --git a/source/includes/fact-read-own-writes.rst b/source/includes/fact-read-own-writes.rst index 7da90fa74a6..400db1b2da2 100644 --- a/source/includes/fact-read-own-writes.rst +++ b/source/includes/fact-read-own-writes.rst @@ -2,9 +2,9 @@ Starting in MongoDB 3.6, you can use :ref:`causally consistent sessions ` to read your own writes, if the writes request acknowledgement. -Prior to MongoDB 3.6, you must have issued your write operation with -:writeconcern:`{ w: "majority" } <"majority">` write concern and then -use either :readconcern:`"majority"` or :readconcern:`"linearizable"` -read concern for the read operations to ensure that a single thread can -read its own writes. +Prior to MongoDB 3.6, in order to read your own writes you must issue +your write operation with :writeconcern:`{ w: "majority" } <"majority">` +write concern, and then issue your read operation with +:readmode:`primary` read preference, and either +:readconcern:`"majority"` or :readconcern:`"linearizable"` read concern. diff --git a/source/includes/fact-selinux-redhat-options.rst b/source/includes/fact-selinux-redhat-options.rst index 5fa20005b61..4b20bd4d2b2 100644 --- a/source/includes/fact-selinux-redhat-options.rst +++ b/source/includes/fact-selinux-redhat-options.rst @@ -1,7 +1,10 @@ .. important:: If SELinux is in ``enforcing`` mode, you must customize your SELinux - policy for MongoDB. + policy for MongoDB by making the following two policy adjustments: + +Permit Access to ``cgroup`` ++++++++++++++++++++++++++++ .. container:: @@ -48,17 +51,65 @@ The MongoDB process is now able to access the correct files with SELinux set to ``enforcing``. +Permit Access to ``netstat`` for FTDC ++++++++++++++++++++++++++++++++++++++ + +.. container:: + + The current SELinux Policy does not allow the MongoDB process to open + and read ``/proc/net/netstat``, which is required for + :ref:`Full Time Diagnostic Data Capture (FTDC) `. + If you intend to run SELinux in + ``enforcing`` mode, you will need to make the following adjustment + to your SELinux policy: + + #. Ensure your system has the ``checkpolicy`` package installed: + + .. code-block:: sh + + sudo yum install checkpolicy + + #. Create a custom policy file :file:`mongodb_proc_net.te`: + + .. code-block:: sh + + cat > mongodb_proc_net.te <`. -Non-Default MongoDB Directory Path(s) +Using a Custom MongoDB Directory Path +++++++++++++++++++++++++++++++++++++ .. container:: @@ -127,58 +178,11 @@ Non-Default MongoDB Directory Path(s) restorecon -R -v '/mongodb/log' -Non-Default MongoDB Ports -+++++++++++++++++++++++++ +Using a Custom MongoDB Port ++++++++++++++++++++++++++++ .. container:: .. code-block:: sh sudo semanage port -a -t mongod_port_t -p tcp - -*Optional.* Suppress ``FTDC`` Warnings -++++++++++++++++++++++++++++++++++++++ - -.. container:: - - The current SELinux Policy does not allow the MongoDB process to open - and read ``/proc/net/netstat`` for :ref:`param-ftdc` (FTDC). As such, - the audit log may include numerous messages regarding lack of access - to this path. - - To track the proposed fix, see ``__. - - Optionally, as a temporary fix, you can manually adjust the SELinux - Policy: - - #. Ensure your system has the ``checkpolicy`` package installed: - - .. code-block:: sh - - sudo yum install checkpolicy - - #. Create a custom policy file :file:`mongodb_proc_net.te`: - - .. code-block:: sh - - cat > mongodb_proc_net.te <: , - ..., - : } - -For example: ``{ targetTotal: 3000 }`` - -Constants must be named according to the :ref:`user variable naming -conventions`. - -To access a constant elsewhere in the command, use the double dollar -sign prefix (``$$``) together with your constant name in the form -``$$``. For example: ``$$targetTotal`` \ No newline at end of file diff --git a/source/includes/list-table-ocsp-parameters.rst b/source/includes/list-table-ocsp-parameters.rst index b2af4ec3cb1..3c4eacc428a 100644 --- a/source/includes/list-table-ocsp-parameters.rst +++ b/source/includes/list-table-ocsp-parameters.rst @@ -9,11 +9,15 @@ - Enables or disables the OCSP support. - * - :parameter:`ocspValidationRefreshPeriodSecs` + * - :parameter:`ocspStaplingRefreshPeriodSecs` - Specifies the number of seconds to wait before refreshing the stapled OCSP status response. + .. include:: /includes/fact-4.4-stapling-refresh-rename.rst + + .. versionchanged:: 4.4.1 + * - :parameter:`tlsOCSPStaplingTimeoutSecs` - Specifies the maximum number of seconds the diff --git a/source/includes/read-preference-modes-table.rst b/source/includes/read-preference-modes-table.rst index 2fa4ab991cc..d0b1a907f6e 100644 --- a/source/includes/read-preference-modes-table.rst +++ b/source/includes/read-preference-modes-table.rst @@ -34,9 +34,17 @@ :ref:`hedged reads ` on sharded clusters. * - :readmode:`nearest` - - Operations read from the member of the :term:`replica set` with - the least network latency, irrespective of whether that member - is a :term:`primary` or :term:`secondary`. + - Operations read from a random eligible :term:`replica set` + member, irrespective of whether that member is a :term:`primary` + or :term:`secondary`, based on a specified latency threshold. + The operation considers the following when calculating latency: + + - The :urioption:`localThresholdMS` connection string option + - The :ref:`maxStalenessSeconds + ` read preference + option + - Any specified :doc:`tag sets + ` Starting in version 4.4, :readmode:`nearest` supports :ref:`hedged reads ` on sharded clusters diff --git a/source/includes/steps-4.4-downgrade-mongod.yaml b/source/includes/steps-4.4-downgrade-mongod.yaml index 93cc8cf8cc4..b04bd3ec15b 100644 --- a/source/includes/steps-4.4-downgrade-mongod.yaml +++ b/source/includes/steps-4.4-downgrade-mongod.yaml @@ -10,22 +10,28 @@ content: | .. include:: /includes/downgrade-path.rst --- -title: "Restart with the latest |oldversion| ``mongod`` instance." +title: "Shut down the ``mongod`` instance." level: 4 -ref: 4.4-downgrade-restart-instance +ref: 4.4-downgrade-shutdown-instance content: | - Shut down your :binary:`~bin.mongod` instance. Replace the existing - binary with the downloaded :binary:`~bin.mongod` binary and restart. - - a. Shut down your :binary:`~bin.mongod` instance. To safely terminate - the :binary:`~bin.mongod` process, you can connect a - :binary:`~bin.mongo` shell to the instance and run: + + To cleanly shut down the :binary:`~bin.mongod` process, connect a + :binary:`~bin.mongo` shell to the instance and run: - .. code-block:: javascript + .. code-block:: javascript - db.adminCommand( { shutdown: 1 } ) + db.adminCommand( { shutdown: 1 } ) + + A :ref:`clean shutdown ` of a + :binary:`~bin.mongod` completes all pending operations, + flushes all data to data files, and closes all data files. +--- +title: "Restart with the latest |oldversion| ``mongod`` instance." +level: 4 +ref: 4.4-downgrade-restart-instance +content: | - b. Replace the |newversion| binary with the downloaded |oldversion| - :binary:`~bin.mongod` binary and restart. + Replace the |newversion| binary with the downloaded |oldversion| + :binary:`~bin.mongod` binary and restart. -... \ No newline at end of file +... diff --git a/source/includes/steps-4.4-downgrade-replica-set.yaml b/source/includes/steps-4.4-downgrade-replica-set.yaml index b381cf41b47..9f9fca98817 100644 --- a/source/includes/steps-4.4-downgrade-replica-set.yaml +++ b/source/includes/steps-4.4-downgrade-replica-set.yaml @@ -17,13 +17,9 @@ content: | Downgrade each :term:`secondary` member of the replica set, one at a time: - a. Shut down the :binary:`~bin.mongod`. + a. .. include:: /includes/4.4-downgrade-clean-shutdown.rst - .. code-block:: javascript - - db.adminCommand( { shutdown: 1 } ) - - #. Replace the |newversion| binary with the |oldversion| binary and restart. + #. Replace the |newversion| binary with the |oldversion| binary and restart. #. Wait for the member to recover to ``SECONDARY`` state before downgrading the next secondary. To check the member's state, @@ -42,13 +38,7 @@ content: | Downgrade the :ref:`arbiter ` member of the replica set: - a. Shut down the :binary:`~bin.mongod`. See - :ref:`terminate-mongod-processes` for additional ways to safely - terminate :binary:`~bin.mongod` processes. - - .. code-block:: javascript - - db.adminCommand( { shutdown: 1 } ) + a. .. include:: /includes/4.4-downgrade-clean-shutdown.rst #. Delete the contents of the arbiter data directory. The :setting:`storage.dbPath` configuration setting or @@ -87,13 +77,9 @@ content: | When :method:`rs.status()` shows that the primary has stepped down and another member has assumed ``PRIMARY`` state: - a. Shut down the previous primary. - - .. code-block:: javascript - - db.adminCommand( { shutdown: 1 } ) + a. .. include:: /includes/4.4-downgrade-clean-shutdown.rst b. Replace the :binary:`~bin.mongod` binary with the |oldversion| binary and restart. -... \ No newline at end of file +... diff --git a/source/includes/steps-4.4-downgrade-sharded-cluster.yaml b/source/includes/steps-4.4-downgrade-sharded-cluster.yaml index 672a6694bac..f802eca3280 100644 --- a/source/includes/steps-4.4-downgrade-sharded-cluster.yaml +++ b/source/includes/steps-4.4-downgrade-sharded-cluster.yaml @@ -56,11 +56,7 @@ content: | A. Downgrade the shard's :ref:`secondary ` members one at a time: - a. Shut down the :binary:`~bin.mongod` instance. - - .. code-block:: javascript - - db.adminCommand( { shutdown: 1 } ) + 1. .. include:: /includes/4.4-downgrade-clean-shutdown.rst #. Replace the |newversion| binary with the |oldversion| binary and restart. @@ -76,13 +72,7 @@ content: | Skip this step if the replica set does not include an arbiter. - a. Shut down the :binary:`~bin.mongod`. See - :ref:`terminate-mongod-processes` for additional ways to safely - terminate :binary:`~bin.mongod` processes. - - .. code-block:: javascript - - db.adminCommand( { shutdown: 1 } ) + 1. .. include:: /includes/4.4-downgrade-clean-shutdown.rst #. Delete the contents of the arbiter data directory. The :setting:`storage.dbPath` configuration setting or @@ -101,7 +91,7 @@ content: | #. Downgrade the shard's primary. - a. Step down the replica set primary. Connect a + 1. Step down the replica set primary. Connect a :binary:`~bin.mongo` shell to the primary and use :method:`rs.stepDown()` to step down the primary and force an election of a new primary: @@ -119,7 +109,10 @@ content: | When the status shows that the primary has stepped down and another member has assumed ``PRIMARY`` state, proceed. - #. Shut down the stepped-down primary. + #. Run the following command from the :binary:`~bin.mongo` shell to + perform a clean shutdown of the stepped-down primary, or refer to + :ref:`terminate-mongod-processes` for additional ways to safely + terminate the :binary:`~bin.mongod` process: .. code-block:: javascript @@ -138,11 +131,7 @@ content: |- A. Downgrade the :ref:`secondary ` members of the config servers replica set (CSRS) one at a time: - a. Shut down the :binary:`~bin.mongod` instance. - - .. code-block:: javascript - - db.adminCommand( { shutdown: 1 } ) + 1. .. include:: /includes/4.4-downgrade-clean-shutdown.rst #. Replace the |newversion| binary with the |oldversion| binary and restart. @@ -157,7 +146,7 @@ content: |- #. Step down the config server primary. - a. Connect a :binary:`~bin.mongo` shell to the primary and use + 1. Connect a :binary:`~bin.mongo` shell to the primary and use :method:`rs.stepDown()` to step down the primary and force an election of a new primary: @@ -174,7 +163,10 @@ content: |- When the status shows that the primary has stepped down and another member has assumed ``PRIMARY`` state, proceed. - #. Shut down the stepped-down primary. + #. Run the following command from the :binary:`~bin.mongo` shell to + perform a clean shutdown of the stepped-down primary, or refer to + :ref:`terminate-mongod-processes` for additional ways to safely + terminate the :binary:`~bin.mongod` process: .. code-block:: javascript @@ -201,4 +193,4 @@ content: | The :binary:`~bin.mongo` shell method :method:`sh.startBalancer()` also enables auto-splitting for the sharded cluster. -... \ No newline at end of file +... diff --git a/source/includes/steps-sharding-segmenting-data-by-location-update.yaml b/source/includes/steps-sharding-segmenting-data-by-location-update.yaml index 85e27fcb2e7..f2a9e0ef169 100644 --- a/source/includes/steps-sharding-segmenting-data-by-location-update.yaml +++ b/source/includes/steps-sharding-segmenting-data-by-location-update.yaml @@ -131,17 +131,24 @@ pre: | :ref:`migrates ` chunks across the shards respecting the configured zones. - Before balancing, the shards in the ``EU`` zone only contained documents - where ``country : DE`` or ``country : UK``. Documents with the ``country : - MX`` could be stored on any shard in the sharded cluster. + Before balancing: + + - shards in the ``EU`` zone only contain documents where + ``country : DE`` or ``country : UK``, and + - documents where ``country : MX`` could be stored on any shard in + the sharded cluster. - After balancing, the shards in the ``EU`` zone should only contain documents - where ``country : DE``, while shards in the ``UK`` zone should only contain - documents where ``country : UK``. Additionally, shards in the ``NA`` zone - should only contain documents where ``country : US`` or ``country : MX``. + After balancing: + + - shards in the ``EU`` zone only contain documents where + ``country : DE``, + - shards in the ``UK`` zone only contain documents where + ``country : UK``, and + - shards in the ``NA`` zone only contain documents where + ``country : US`` or ``country : MX``. - A document with a value for ``country`` other than ``NA``, ``MX``, ``UK``, - or ``DE`` can reside on any shard in the cluster. + A document with a value for ``country`` other than ``US``, ``MX``, + ``UK``, or ``DE`` can reside on any shard in the cluster. - You can confirm the chunk distribution by running :method:`sh.status()`. -... \ No newline at end of file + To confirm the chunk distribution, run :method:`sh.status()`. +... diff --git a/source/includes/steps-sharding-segmenting-data-by-location.yaml b/source/includes/steps-sharding-segmenting-data-by-location.yaml index cc8e5638709..210f92a6705 100644 --- a/source/includes/steps-sharding-segmenting-data-by-location.yaml +++ b/source/includes/steps-sharding-segmenting-data-by-location.yaml @@ -136,12 +136,15 @@ pre: | :ref:`migrates ` chunks across the shards respecting the configured zones. - Once balancing finishes, the shards in the ``NA`` zone should only - contain documents with ``country : NA``, while shards in the ``EU`` zone - should only contain documents with ``country : UK`` or ``country : DE``. + Once balancing finishes: - A document with a value for ``country`` other than ``NA``, ``UK``, or + - shards in the ``NA`` zone should only contain documents with + ``country : US``, and + - shards in the ``EU`` zone should only contain documents with + ``country : UK`` or ``country : DE``. + + A document with a value for ``country`` other than ``US``, ``UK``, or ``DE`` can reside on any shard in the cluster. - You can confirm the chunk distribution by running :method:`sh.status()`. -... \ No newline at end of file + To confirm the chunk distribution, run :method:`sh.status()`. +... diff --git a/source/installation.txt b/source/installation.txt index f2083584eaf..2fc72739b5d 100644 --- a/source/installation.txt +++ b/source/installation.txt @@ -29,7 +29,7 @@ This section of the manual contains information on installing MongoDB. - For instructions on upgrading your current deployment to MongoDB - 4.2, see :ref:`4.2-upgrade` instead. + {+version+}, see :ref:`{+version+}-upgrade` instead. - For instructions on upgrading to the latest patch release for your current version, see :doc:`/tutorial/upgrade-revision` instead. @@ -144,6 +144,10 @@ s390x (MongoDB Enterprise Edition) .. include:: /includes/fact-platform-s390x-enterprise.rst +Containers +~~~~~~~~~~ + +.. include:: /includes/fact-platform-containers.rst .. toctree:: :hidden: diff --git a/source/meta/aggregation-quick-reference.txt b/source/meta/aggregation-quick-reference.txt index c472c467413..dbd20acad67 100644 --- a/source/meta/aggregation-quick-reference.txt +++ b/source/meta/aggregation-quick-reference.txt @@ -262,6 +262,11 @@ Literal Expression Operator .. include:: /includes/extracts/agg-operators-literal.rst +Miscellaneous Operators +~~~~~~~~~~~~~~~~~~~~~~~ + +.. include:: /includes/extracts/agg-operators-miscellaneous.rst + Object Expression Operators ~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -356,6 +361,7 @@ Index of Expression Operators - :expression:`$cond` - :expression:`$convert` - :expression:`$cos` + - :expression:`$cosh` - :expression:`$dateFromParts` - :expression:`$dateFromString` - :expression:`$dateToParts` @@ -429,6 +435,7 @@ Index of Expression Operators - :expression:`$setIsSubset` - :expression:`$setUnion` - :expression:`$sin` + - :expression:`$sinh` - :expression:`$size` - :expression:`$slice` - :expression:`$split` @@ -445,6 +452,7 @@ Index of Expression Operators - :group:`$sum` - :expression:`$switch` - :expression:`$tan` + - :expression:`$tanh` - :expression:`$toBool` - :expression:`$toDate` - :expression:`$toDecimal` diff --git a/source/reference/bson-type-comparison-order.txt b/source/reference/bson-type-comparison-order.txt index f9331831890..78c943906da 100644 --- a/source/reference/bson-type-comparison-order.txt +++ b/source/reference/bson-type-comparison-order.txt @@ -63,7 +63,25 @@ MongoDB's comparison of :term:`BSON` objects uses the following order: #. Recursively compare key-value pairs in the order that they appear within the BSON object. -#. Compare the :ref:`key field names `. +#. Compare the field types. MongoDB uses the following comparison + order for field types, from lowest to highest: + + a. MinKey (internal type) + #. Null + #. Numbers (ints, longs, doubles, decimals) + #. Symbol, String + #. Object + #. Array + #. BinData + #. ObjectId + #. Boolean + #. Date + #. Timestamp + #. Regular Expression + #. MaxKey (internal type) + +#. If the field types are equal, compare the + :ref:`key field names `. #. If the key field names are equal, compare the field values. diff --git a/source/reference/change-events.txt b/source/reference/change-events.txt index 587f3e896fd..c05d2394b45 100644 --- a/source/reference/change-events.txt +++ b/source/reference/change-events.txt @@ -62,8 +62,10 @@ following table describes each field in the change stream response document: - document - .. _change-stream-event-id: - Metadata related to the operation. Acts as the ``resumeToken`` + A :term:`BSON` object which serves as an identifier for the + change stream event. This value is used as the ``resumeToken`` for the ``resumeAfter`` parameter when resuming a change stream. + The ``_id`` object has the following form: .. code-block:: none @@ -72,9 +74,13 @@ following table describes each field in the change stream response document: } The ``_data`` type depends on the MongoDB versions - and, in some cases, the feature compatibility version (fcv) at - the time of the change stream's opening/resumption. For details, - see :ref:`change-stream-resume-token`. + and, in some cases, the :ref:`feature compatibility version (fCV) + ` at the time of the change stream's + opening/resumption. See :ref:`change-stream-resume-token` for the + full list of ``_data`` types. + + See :ref:`change-stream-resume` for an example of resuming a + change stream by ``resumeToken``. * - ``operationType`` - string diff --git a/source/reference/command/addShard.txt b/source/reference/command/addShard.txt index 01110c255c9..3ef0d2b6b0a 100644 --- a/source/reference/command/addShard.txt +++ b/source/reference/command/addShard.txt @@ -113,3 +113,11 @@ The following command adds a replica set as a shard: Do not use ``localhost`` for the hostname unless your config server is also running on ``localhost``. + +.. seealso:: + + - :command:`listShards` + + - :command:`removeShard` + + - :method:`sh.addShard()` diff --git a/source/reference/command/aggregate.txt b/source/reference/command/aggregate.txt index 7280361eff2..117d80e6df2 100644 --- a/source/reference/command/aggregate.txt +++ b/source/reference/command/aggregate.txt @@ -23,10 +23,10 @@ Definition Syntax ------ -.. versionchanged:: 5.0 - The command has following syntax: +.. versionchanged:: 3.6 + .. code-block:: javascript { @@ -41,8 +41,7 @@ The command has following syntax: collation: , hint: , comment: , - writeConcern: , - let: // Added in MongoDB 5.0 + writeConcern: } .. tip:: @@ -149,7 +148,7 @@ arguments: - Enables :samp:`aggregate` to bypass document validation + Enables :dbcommand:`aggregate` to bypass document validation during the operation. This lets you insert documents that do not meet the validation requirements. @@ -226,24 +225,11 @@ arguments: Omit to use the default write concern with the :pipeline:`$out` or :pipeline:`$merge` stage. + + - * - ``let`` - - - document - - - .. _aggregate-let-option: - - Optional. - - .. include:: /includes/let-constants.rst - - For an example, see :ref:`aggregate-let`. - - .. versionadded:: 5.0 - - .. include:: /includes/deprecation-aggregate-wo-cursor.rst For more information about the aggregation pipeline @@ -549,30 +535,5 @@ majority of the nodes. .. include:: /includes/usage-read-concern-majority.rst -.. _aggregate-let: - -Use Constants in ``let`` -~~~~~~~~~~~~~~~~~~~~~~~~ - -.. versionadded:: 5.0 - -To specify constants that can be accessed elsewhere in the command, use -the :ref:`let ` option. - -.. include:: /includes/let-constants-example.rst - -.. code-block:: javascript - - db.runCommand( { - aggregate: db.cakeSales.getName(), - pipeline: [ - { $match: { - $expr: { $gt: [ "$salesTotal", "$$targetTotal" ] } - } }, - ], - cursor: {}, - let: { targetTotal: 3000 } - } ) - .. seealso:: :method:`db.collection.aggregate()` diff --git a/source/reference/command/createUser.txt b/source/reference/command/createUser.txt index 0f5dcda6404..3db870a6d38 100644 --- a/source/reference/command/createUser.txt +++ b/source/reference/command/createUser.txt @@ -227,7 +227,7 @@ Authentication Restrictions Behavior -------- -User Id +User ID ~~~~~~~ Starting in version 4.0.9, MongoDB automatically assigns a unique diff --git a/source/reference/command/dbStats.txt b/source/reference/command/dbStats.txt index 3a1af9133fc..871c34873a2 100644 --- a/source/reference/command/dbStats.txt +++ b/source/reference/command/dbStats.txt @@ -24,7 +24,7 @@ Definition db.runCommand( { dbStats: 1, - scale: // Optional + scale: //Optional } ) The :dbcommand:`dbStats` command takes the following fields: @@ -90,111 +90,73 @@ Output .. data:: dbStats.db - Name of the database. + Contains the name of the database. .. data:: dbStats.collections - Number of collections in the database. + Contains a count of the number of collections in that database. .. data:: dbStats.views - Number of :doc:`views ` in the database. + Contains a count of the number of :doc:`views ` in that database. .. data:: dbStats.objects - Number of objects (specifically, :term:`documents `) in the - database across all collections. + Contains a count of the number of objects (i.e. :term:`documents `) in + the database across all collections. .. data:: dbStats.avgObjSize - Average size of each document in bytes. This is the + The average size of each document in bytes. This is the :data:`~dbStats.dataSize` divided by the number of documents. The :ref:`scale argument ` does not affect the ``avgObjSize`` value. .. data:: dbStats.dataSize - Total size of the uncompressed data held in the database. The - :data:`~dbStats.dataSize` decreases when you remove :term:`documents - `. + The total size of the uncompressed data held in this database. + The :data:`~dbStats.dataSize` decreases + when you remove :term:`documents `. - For databases using the :ref:`WiredTiger - ` storage engine, ``dataSize`` may be - larger than ``storageSize`` if compression is enabled. The - ``dataSize`` decreases when documents shrink. + For databases using the :ref:`WiredTiger ` storage engine, + ``dataSize`` may be larger than ``storageSize`` if compression is enabled. The ``dataSize`` + decreases when documents shrink. .. sum of all records not counting deleted records .. data:: dbStats.storageSize - Sum of the space allocated to all collections in the database for - :term:`document` storage, including free space. + The total amount of space allocated to collections in this database + for :term:`document` storage. The :data:`~dbStats.storageSize` does + not decrease as you remove or shrink documents. This value may be + smaller than ``dataSize`` for databases using the WiredTiger storage + engine with + :ref:`compression ` enabled. - The :data:`~dbStats.storageSize` does not decrease as you remove or - shrink documents. This value may be smaller than - :data:`~dbStats.dataSize` for databases using the WiredTiger storage - engine with :ref:`compression ` - enabled. - - :data:`~dbStats.storageSize` does not include space allocated to - indexes. See :data:`~dbStats.indexSize` for the total index size. + :data:`~dbStats.storageSize` does not include the index size. See + :data:`~dbStats.indexSize` for index sizing. + .. sum of all extents (no indexes or the $freelist) .. include links to eventual documentation of storage management -.. data:: dbStats.freeStorageSize - - Sum of the free space allocated to all collections in the database - for :term:`document` storage. Free database storage space is - allocated to the collection but does not contain data. - - :data:`~dbStats.freeStorageSize` does not include free space - allocated to indexes. See :data:`~dbStats.indexFreeStorageSize` for - the total free index size. - - .. versionadded:: 5.0 - .. data:: dbStats.indexes - Total number of indexes across all collections in the database. + Contains a count of the total number of indexes across all + collections in the database. .. data:: dbStats.indexSize - Sum of the space allocated to all indexes in the database, including - free index space. - -.. data:: dbStats.indexFreeStorageSize - - Sum of the free space allocated to all indexes in the database. Free - database storage space is allocated to the index but does not contain - data. - - :data:`~dbStats.indexFreeStorageSize` does not include free space - allocated to document storage. See :data:`~dbStats.freeStorageSize` - for the total free document storage size. - - .. versionadded:: 5.0 + The total size of all indexes created on this database. .. data:: dbStats.totalSize - Sum of the space allocated for both documents and indexes in all - collections in the database. Includes used and free storage space. - This is the sum of :data:`~dbStats.storageSize` and - :data:`~dbStats.indexSize`. + The sum of the :data:`~dbStats.storageSize` and :data:`~dbStats.indexSize`. .. versionadded:: 4.4 -.. data:: dbStats.totalFreeStorageSize - - Sum of the free storage space allocated for both documents and - indexes in all collections in the database. This is the sum of - :data:`~dbStats.freeStorageSize` and - :data:`~dbStats.indexFreeStorageSize`. - - .. versionadded:: 5.0 - .. data:: dbStats.scaleFactor - ``scale`` value used by the command. + The ``scale`` value used by the command. If you specified a non-integer scale factor, MongoDB uses the integer part of the specified factor. For example, if you specify a @@ -205,18 +167,18 @@ Output .. data:: dbStats.fsUsedSize + .. versionadded:: 3.6 + Total size of all disk space in use on the filesystem where MongoDB stores data. - .. versionadded:: 3.6 - .. seealso:: :option:`--dbpath ` .. data:: dbStats.fsTotalSize + .. versionadded:: 3.6 + Total size of all disk capacity on the filesystem where MongoDB stores data. - - .. versionadded:: 3.6 diff --git a/source/reference/command/findAndModify.txt b/source/reference/command/findAndModify.txt index 8fad4fdf55e..d44a01cfe1b 100644 --- a/source/reference/command/findAndModify.txt +++ b/source/reference/command/findAndModify.txt @@ -78,7 +78,9 @@ Definition - * - ``sort`` + * - .. _findandmodify-command-stable-sorting: + + ``sort`` - document @@ -88,6 +90,10 @@ Definition Starting in MongoDB 4.2 (and 4.0.12+, 3.6.14+, and 3.4.23+), the operation errors if the sort argument is not a document. + + .. include:: /includes/fact-sort-stability.rst + + See :ref:`sort-cursor-stable-sorting` for more information. @@ -159,7 +165,7 @@ Definition - boolean - - Optional. Enables :samp:`findAndModify` to bypass document validation + - Optional. Enables :dbcommand:`findAndModify` to bypass document validation during the operation. This lets you update documents that do not meet the validation requirements. diff --git a/source/reference/command/insert.txt b/source/reference/command/insert.txt index a6fd8c7da1e..f54750c7ed3 100644 --- a/source/reference/command/insert.txt +++ b/source/reference/command/insert.txt @@ -88,7 +88,7 @@ Definition - boolean - - Optional. Enables :samp:`insert` to bypass document validation + - Optional. Enables :dbcommand:`insert` to bypass document validation during the operation. This lets you insert documents that do not meet the validation requirements. diff --git a/source/reference/command/listCollections.txt b/source/reference/command/listCollections.txt index 0c33897087d..795600f78cb 100644 --- a/source/reference/command/listCollections.txt +++ b/source/reference/command/listCollections.txt @@ -49,7 +49,7 @@ Definition - Optional. A query expression to filter the list of collections. You can specify a query expression on any of the :ref:`fields - returned ` by :samp:`listCollections`. + returned ` by :dbcommand:`listCollections`. diff --git a/source/reference/command/listShards.txt b/source/reference/command/listShards.txt index 97059115665..f262fc8a937 100644 --- a/source/reference/command/listShards.txt +++ b/source/reference/command/listShards.txt @@ -119,3 +119,9 @@ Output - The ``ok`` status field, the ``operationTime`` field, and the ``$clusterTime`` field for the operation. For details on these fields, see :ref:`command-response`. + +.. seealso:: + + - :command:`addShard` + + - :command:`removeShard` diff --git a/source/reference/command/profile.txt b/source/reference/command/profile.txt index a2a5b0831c0..9bdc2794ab6 100644 --- a/source/reference/command/profile.txt +++ b/source/reference/command/profile.txt @@ -15,28 +15,46 @@ Definition .. dbcommand:: profile - .. versionchanged:: 4.0 - - The command can be run on :binary:`~bin.mongos` with ``profile`` - level: - - - ``0`` to set the ``slowms`` and ``sampleRate`` for the system - log; i.e. you cannot enable the profiler on a - :binary:`~bin.mongos`. - - - ``-1`` to read the current settings. + .. versionchanged:: 4.4.2 For a :binary:`~bin.mongod` instance, the command enables, disables, or configures the :doc:`/tutorial/manage-the-database-profiler`. The profiler captures and records data on the performance of write operations, cursors, and database commands on a running :binary:`~bin.mongod` instance. If the profiler is disabled, the - command sets the ``slowms`` and ``sampleRate`` for logging slow - operations to the diagnostic log. + command configures how slow operations are logged to the diagnostic + log. + + On :binary:`~bin.mongod`, if the :ref:`database profiler level + ` is ``1`` or ``2`` (i.e. the + :doc:`database profiler ` is + enabled), the :ref:`slowms `, + :ref:`sampleRate `, and + :ref:`filter ` affect the + behavior of both the profiler and the :option:`diagnostic log `. + + If the :ref:`database profiler level ` is + ``0`` (i.e. :doc:`database profiler + ` is disabled), the + :ref:`slowms `, + :ref:`sampleRate `, and + :ref:`filter ` affect + only the diagnostic log. - For :binary:`~bin.mongos` instance, the command sets the ``slowms`` - and ``sampleRate`` configuration settings, which configure how - operations get written to the diagnostic log. + (*Starting in MongoDB 4.0*): For :binary:`~bin.mongos` instance, the + command only configures how operations get written to the diagnostic + log. You cannot enable the + :doc:`/tutorial/manage-the-database-profiler` on a + :binary:`~bin.mongos` instance because ``mongos`` does not have any + collections that the profiler can write to. + + On :binary:`~bin.mongos`, you can set ``profile`` level to: + + - ``0`` to set the ``slowms``, ``sampleRate``, and ``filter`` for + the diagnostic log; + + - ``-1`` to read the current settings. The profiler is off by default. @@ -49,7 +67,8 @@ Definition { profile: , slowms: , - sampleRate: + sampleRate: , + filter: } .. _slowms-threshold-option: @@ -111,10 +130,36 @@ Definition (available starting in MongoDB 4.2) `. .. versionadded:: 3.6 - - + + * - ``filter`` + + - object + + - Optional. + + A filter expression that controls which operations are + profiled and logged. + + The ``filter`` expression takes the following form: + .. code-block:: javascript + + { : , ... } + + The ```` can be + :ref:`any field in the profiler output `. The + ```` is a + :ref:`query condition expression `. + .. note:: + + This argument affects the same setting as the configuration + option :setting:`~operationProfiling.filter`. When + ``filter`` is set, the ``slowms`` and ``sampleRate`` + options are not used for profiling and slow-query log + lines. + + .. versionadded:: 4.4.2 The :method:`db.getProfilingStatus()` and :method:`db.setProfilingLevel()` :doc:`shell methods @@ -131,5 +176,11 @@ database while enabling or disabling the profiler. This is typically a short operation. The lock blocks other operations until the :dbcommand:`profile` command has completed. +Starting in MongoDB 4.4.2, when connected to a sharded cluster through +:binary:`~bin.mongos`, you can run the :dbcommand:`profile` command +against any database. In previous versions of MongoDB, when connected +through :binary:`~bin.mongos`, you can only run the :dbcommand:`profile` +command against the ``admin`` database. + .. seealso:: :ref:`Database Profiling `. diff --git a/source/reference/command/removeShard.txt b/source/reference/command/removeShard.txt index 691db196132..aa206c394a9 100644 --- a/source/reference/command/removeShard.txt +++ b/source/reference/command/removeShard.txt @@ -242,3 +242,9 @@ the following: } } } + +.. seealso:: + + - :command:`addShard` + + - :command:`listShards` diff --git a/source/reference/command/serverStatus.txt b/source/reference/command/serverStatus.txt index 5dc40b71af3..1455145283e 100644 --- a/source/reference/command/serverStatus.txt +++ b/source/reference/command/serverStatus.txt @@ -1325,21 +1325,26 @@ network .. serverstatus:: network - A document that reports data on MongoDB's network use. + A document that reports data on MongoDB's network use. These + statistics measure *ingress connections* only, i.e. traffic + seen by the :binary:`~bin.mongod` / :binary:`~bin.mongos` over + network connections initiated by clients or other + :binary:`~bin.mongod` / :binary:`~bin.mongos` instances. Traffic from + network connections initiated by this :binary:`~bin.mongod` / + :binary:`~bin.mongos` instance (i.e. *egress connections*) is *not* + measured in these statistics. .. serverstatus:: network.bytesIn - The number of bytes that reflects the amount of network traffic - received *by* this database. Use this value to ensure that network - traffic sent to the :binary:`~bin.mongod` process is consistent with - expectations and overall inter-application traffic. + The total number of bytes that the server has *received* over network + connections initiated by clients or other :binary:`~bin.mongod` / + :binary:`~bin.mongos` instances. .. serverstatus:: network.bytesOut - The number of bytes that reflects the amount of network traffic sent - *from* this database. Use this value to ensure that network traffic - sent by the :binary:`~bin.mongod` process is consistent with - expectations and overall inter-application traffic. + The total number of bytes that the server has *sent* over network + connections initiated by clients or other :binary:`~bin.mongod` / + :binary:`~bin.mongos` instances. .. serverstatus:: network.numSlowDNSOperations @@ -1412,8 +1417,8 @@ network .. versionadded:: 4.4 The total number of accepted incoming TCP Fast Open (TFO) connections - to the :binary:`~bin.mongod`/:binary:`~bin.mongos` since the - ``mongod/mongos`` last started. + to the :binary:`~bin.mongod` / :binary:`~bin.mongos` since the + ``mongod / mongos`` last started. opLatencies ~~~~~~~~~~~ @@ -4001,8 +4006,8 @@ metrics "num" : , "totalMillis" : }, - "notMasterLegacyUnacknowledgedWrites" : , - "notMasterUnacknowledgedWrites" : , + "notPrimaryUnacknowledgedWrites" : , + "notPrimaryLegacyUnacknowledgedWrites" : , "oplogGetMoresProcessed" : { "num" : , "totalMillis" : @@ -4394,20 +4399,26 @@ metrics .. versionadded:: 4.4 -.. serverstatus:: metrics.repl.network.notMasterLegacyUnacknowledgedWrites +.. serverstatus:: metrics.repl.network.notPrimaryLegacyUnacknowledgedWrites The number of unacknowledged (``w: 0``) legacy write operations (see :ref:`wp-request-opcodes`) that failed because the current :binary:`~bin.mongod` is not in :replstate:`PRIMARY` state. + This field name was changed in MongoDB 4.4.3. Previously, this field + was named ``notMasterLegacyUnacknowledgedWrites``. + .. versionadded:: 4.2 -.. serverstatus:: metrics.repl.network.notMasterUnacknowledgedWrites +.. serverstatus:: metrics.repl.network.notPrimaryUnacknowledgedWrites The number of unacknowledged (``w: 0``) write operations that failed because the current :binary:`~bin.mongod` is not in :replstate:`PRIMARY` state. + This field name was changed in MongoDB 4.4.3. Previously, this field + was named ``notMasterUnacknowledgedWrites``. + .. versionadded:: 4.2 .. serverstatus:: metrics.repl.network.oplogGetMoresProcessed diff --git a/source/reference/command/update.txt b/source/reference/command/update.txt index f2ad9fefcde..688d57e4616 100644 --- a/source/reference/command/update.txt +++ b/source/reference/command/update.txt @@ -123,7 +123,7 @@ The command takes the following fields: - boolean - - Optional. Enables :samp:`update` to bypass document validation + - Optional. Enables :dbcommand:`update` to bypass document validation during the operation. This lets you update documents that do not meet the validation requirements. diff --git a/source/reference/configuration-options.txt b/source/reference/configuration-options.txt index 6d75edde3ce..b15932dae8c 100644 --- a/source/reference/configuration-options.txt +++ b/source/reference/configuration-options.txt @@ -224,19 +224,24 @@ Core Options *Type*: boolean - Run :binary:`~bin.mongos` or :binary:`~bin.mongod` in a quiet mode that attempts to limit the amount - of output. + *Default*: false + + Run :binary:`~bin.mongos` or :binary:`~bin.mongod` in a quiet mode + that attempts to limit the amount of output. - :setting:`systemLog.quiet` is **not** recommended for production systems as it may make - tracking problems during particular connections much more difficult. + :setting:`systemLog.quiet` is **not** recommended for production + systems as it may make tracking problems during particular + connections much more difficult. .. setting:: systemLog.traceAllExceptions *Type*: boolean - Print verbose information for debugging. Use for additional logging for - support-related troubleshooting. + *Default*: false + + Print verbose information for debugging. Use for additional logging + for support-related troubleshooting. @@ -3916,6 +3921,7 @@ LDAP Parameters mode: slowOpThresholdMs: slowOpSampleRate: + filter: .. _configuration-profiling-mode: .. setting:: operationProfiling.mode @@ -4007,8 +4013,54 @@ LDAP Parameters - For :binary:`~bin.mongos` instances, the setting affects the diagnostic log only and not the profiler since profiling is not available on :binary:`~bin.mongos`. + +.. setting:: operationProfiling.filter + + *Type*: string representation of a query document + + A filter expression that controls which operations are profiled and + logged. + + When ``filter`` is set, + :setting:`~operationProfiling.slowOpThresholdMs` and + :setting:`~operationProfiling.slowOpSampleRate` are not used for + profiling and slow-query log lines. + + When you set a profile filter in the configuration file, the filter + applies to all databaes in the deployment. To set a profile filter + for a specific database, use the :method:`db.setProfilingLevel()` + method. + + The option takes a string representation of a query document + of the form: + .. code-block:: javascript + + { : , ... } + + The ```` can be :ref:`any field in the profiler output + `. The ```` is a :ref:`query condition + expression `. + + To specify a profiling filter in a :doc:`configuration file + `, you must: + + - Enclose the filter document in single quotes to pass the document + as a string. + + - Use the YAML format of the configuration file. + + For example, the following ``filter`` configures the profiler to + log ``query`` operations that take longer than 2 seconds: + + .. code-block:: yaml + :emphasize-lines: 3 + + operationProfiling: + mode: all + filter: '{ op: "query", millis: { $gt: 2000 } }' + .. versionadded:: 4.4.2 .. _replication-options: diff --git a/source/reference/glossary.txt b/source/reference/glossary.txt index 24732f449a5..ffcc5c5ec58 100644 --- a/source/reference/glossary.txt +++ b/source/reference/glossary.txt @@ -581,11 +581,13 @@ Glossary See :term:`natural order`. ObjectId - A special 12-byte :term:`BSON` type that guarantees uniqueness - within the :term:`collection`. The ObjectId is generated based on - timestamp, machine ID, process ID, and a process-local incremental - counter. MongoDB uses ObjectId values as the default values for - :term:`_id` fields. + A special :term:`BSON` type that guarantees uniqueness within the + :term:`collection`. :ref:`objectid` values are 12 bytes in length, + consisting of: + + .. include:: /includes/fact-ObjectId-construct.rst + + See :ref:`document-bson-type-object-id` for BSON-specific information. operator A keyword beginning with a ``$`` used to express an update, diff --git a/source/reference/local-database.txt b/source/reference/local-database.txt index e2f5569e2fb..1fec1d8e786 100644 --- a/source/reference/local-database.txt +++ b/source/reference/local-database.txt @@ -26,8 +26,8 @@ instance-specific data. The ``local`` database is invisible to replication: collections in the ``local`` database are not replicated. -Collection on all ``mongod`` Instances --------------------------------------- +Collections on all ``mongod`` Instances +--------------------------------------- .. data:: local.startup_log @@ -118,14 +118,19 @@ Collections on Replica Set Members :data:`local.oplog.rs` is the capped collection that holds the :term:`oplog`. You set its size at creation using the - :setting:`~replication.oplogSizeMB` setting. To resize the oplog after replica set - initiation, use the :doc:`/tutorial/change-oplog-size` - procedure. For additional information, see the - :ref:`replica-set-oplog-sizing` section. - - .. note:: - - .. include:: /includes/fact-oplog-size.rst + :setting:`~replication.oplogSizeMB` setting. To resize the oplog + after replica set initiation, use the + :doc:`/tutorial/change-oplog-size` procedure. For additional + information, see the :ref:`replica-set-oplog-sizing` section. + + .. include:: /includes/fact-oplog-size.rst + + Starting in MongoDB 4.4.2, it is no longer possible to perform manual + write operations to the :doc:`oplog ` on a + cluster running as a :ref:`replica set `. Performing + write operations to the oplog when running as a + :term:`standalone instance ` should only be done with + guidance from MongoDB Support. .. data:: local.replset.minvalid diff --git a/source/reference/method/cursor.limit.txt b/source/reference/method/cursor.limit.txt index 956592d9430..643d9040d8c 100644 --- a/source/reference/method/cursor.limit.txt +++ b/source/reference/method/cursor.limit.txt @@ -31,7 +31,7 @@ Definition Use :method:`~cursor.limit()` to maximize performance and prevent MongoDB from returning more results than required for processing. - The :method:`cursor.limit()` method has the following prototype form: + The :method:`~cursor.limit()` method has the following prototype form: .. code-block:: javascript @@ -64,3 +64,16 @@ into a single batch, the number of documents received will be less than the specified limit. By passing a negative limit, the client indicates to the server that it will not ask for a subsequent batch via ``getMore``. + +Using ``limit()`` with ``sort()`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +If using :method:`~cursor.limit()` with :method:`~cursor.sort()`, be +sure that you are performing a *stable sort* before passing +results to :method:`~cursor.limit()`. A stable sort ensures that the +sort order of returned documents remains the same across multiple +executions of the same sort; especially important when used with the +:method:`~cursor.limit()` method. + +See :ref:`Stable sorting with the sort() method +` for more information. diff --git a/source/reference/method/cursor.skip.txt b/source/reference/method/cursor.skip.txt index 362f4e9cf88..66d0540ce15 100644 --- a/source/reference/method/cursor.skip.txt +++ b/source/reference/method/cursor.skip.txt @@ -19,16 +19,16 @@ Definition .. include:: /includes/fact-mongo-shell-method.rst - Call the :method:`cursor.skip()` method on a cursor to control where + Call the :method:`~cursor.skip()` method on a cursor to control where MongoDB begins returning results. This approach may be useful in implementing paginated results. .. note:: - You must apply :method:`cursor.skip()` to the cursor before + You must apply :method:`~cursor.skip()` to the cursor before retrieving any documents from the database. - The :method:`cursor.skip()` method has the following parameter: + The :method:`~cursor.skip()` method has the following parameter: .. list-table:: @@ -47,24 +47,37 @@ Definition - The number of documents to skip in the results set. - - +Behavior +-------- + +Using ``skip()`` with ``sort()`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +If using :method:`~cursor.skip()` with :method:`~cursor.sort()`, +be sure that you are performing a *stable sort* before passing +results to :method:`~cursor.skip()`. A stable sort ensures that the sort +order of returned documents remains the same across multiple executions +of the same sort; especially important when used with the +:method:`~cursor.skip()` method. + +See :ref:`Stable sorting with the sort() method +` for more information. Pagination Example ------------------ -Using :method:`cursor.skip()` -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Using ``skip()`` +~~~~~~~~~~~~~~~~ -The following JavaScript function uses :method:`cursor.skip()` to -paginate a collection in :term:`natural order`: +The following JavaScript function uses :method:`~cursor.skip()` to +paginate a collection by its ``_id`` field: .. code-block:: javascript function printStudents(pageNumber, nPerPage) { print( "Page: " + pageNumber ); db.students.find() + .sort( { _id: 1 } ) .skip( pageNumber > 0 ? ( ( pageNumber - 1 ) * nPerPage ) : 0 ) .limit( nPerPage ) .forEach( student => { @@ -72,16 +85,16 @@ paginate a collection in :term:`natural order`: } ); } -The :method:`cursor.skip()` method requires the server to scan from the +The :method:`~cursor.skip()` method requires the server to scan from the beginning of the input results set before beginning to return results. -As the offset increases, :method:`cursor.skip()` will become slower. +As the offset increases, :method:`~cursor.skip()` will become slower. Using Range Queries ~~~~~~~~~~~~~~~~~~~ Range queries can use :ref:`indexes ` to avoid scanning unwanted documents, typically yielding better performance as the offset -grows compared to using :method:`cursor.skip()` for pagination. +grows compared to using :method:`~cursor.skip()` for pagination. Descending Order ```````````````` @@ -92,7 +105,7 @@ Use this procedure to implement pagination with range queries: direction over time and has a :ref:`unique index ` to prevent duplicate values, * Query for documents whose field is less than the start value - using the :query:`$lt` and :method:`cursor.sort()` operators, and + using the :query:`$lt` and :method:`~cursor.sort()` operators, and * Store the last-seen field value for the next query. For example, the following function uses the above procedure to print diff --git a/source/reference/method/cursor.sort.txt b/source/reference/method/cursor.sort.txt index 50ea3283daf..175ffb5c138 100644 --- a/source/reference/method/cursor.sort.txt +++ b/source/reference/method/cursor.sort.txt @@ -60,12 +60,73 @@ Definition Behaviors --------- -Result Ordering -~~~~~~~~~~~~~~~ +.. _sort-cursor-stable-sorting: -Unless you specify the :method:`~cursor.sort()` method or use the -:query:`$near` operator, MongoDB does **not** guarantee the order of -query results. +Sort Stability +~~~~~~~~~~~~~~ + +.. versionchanged:: 4.4 + +.. include:: /includes/fact-sort-stability.rst + +Consider the following ``restaurant`` collection: + +.. code-block:: js + + db.restaurants.insertMany( [ + { "_id" : 1, "name" : "Central Park Cafe", "borough" : "Manhattan"}, + { "_id" : 2, "name" : "Rock A Feller Bar and Grill", "borough" : "Queens"}, + { "_id" : 3, "name" : "Empire State Pub", "borough" : "Brooklyn"}, + { "_id" : 4, "name" : "Stan's Pizzaria", "borough" : "Manhattan"}, + { "_id" : 5, "name" : "Jane's Deli", "borough" : "Brooklyn"}, + ] ); + +The following command uses the :method:`~cursor.sort()` method to sort +on the ``borough`` field: + +.. code-block:: js + + db.restaurants.find().sort( { "borough": 1 } ) + +In this example, the sort is *unstable*, since the ``borough`` field +contains duplicate values for both ``Manhattan`` and ``Brooklyn``. +Documents are returned in alphabetical order by ``borough``, but the +order of those documents with duplicate values for ``borough`` might not +the be the same across multiple executions of the same sort. For +example, here are the results from two different executions of the +above command: + +.. code-block:: js + :copyable: false + + { "_id" : 3, "name" : "Empire State Pub", "borough" : "Brooklyn" } + { "_id" : 5, "name" : "Jane's Deli", "borough" : "Brooklyn" } + { "_id" : 1, "name" : "Central Park Cafe", "borough" : "Manhattan" } + { "_id" : 4, "name" : "Stan's Pizzaria", "borough" : "Manhattan" } + { "_id" : 2, "name" : "Rock A Feller Bar and Grill", "borough" : "Queens" } + + { "_id" : 5, "name" : "Jane's Deli", "borough" : "Brooklyn" } + { "_id" : 3, "name" : "Empire State Pub", "borough" : "Brooklyn" } + { "_id" : 4, "name" : "Stan's Pizzaria", "borough" : "Manhattan" } + { "_id" : 1, "name" : "Central Park Cafe", "borough" : "Manhattan" } + { "_id" : 2, "name" : "Rock A Feller Bar and Grill", "borough" : "Queens" } + +While the values for ``borough`` are still sorted in alphabetical order, +the order of the documents containing duplicate values for ``borough`` +(i.e. ``Manhattan`` and ``Brooklyn``) is not the same. + +To achieve a *stable sort*, add a field which contains exclusively +unique values to the sort. The following command uses the +:method:`~cursor.sort()` method to sort on both the ``borough`` field +and the ``_id`` field: + +.. code-block:: js + + db.restaurants.find().sort( { "borough": 1, "_id": 1 } ) + +Since the ``_id`` field is always guaranteed to contain exclusively +unique values, the returned sort order will always be the same across +multiple executions of the same sort. .. _sort-asc-desc: diff --git a/source/reference/method/db.collection.aggregate.txt b/source/reference/method/db.collection.aggregate.txt index b7a67ef92fa..b113395dc3e 100644 --- a/source/reference/method/db.collection.aggregate.txt +++ b/source/reference/method/db.collection.aggregate.txt @@ -61,7 +61,6 @@ Definition The ``options`` document can contain the following fields and values: - .. versionchanged:: 5.0 .. list-table:: :header-rows: 1 @@ -206,22 +205,8 @@ Definition Omit to use the default write concern with the :pipeline:`$out` or :pipeline:`$merge` stage. - - - - * - ``let`` - - - document - - - .. _db.collection.aggregate-let-option: - - Optional. - - .. include:: /includes/let-constants.rst - - For an example, see :ref:`db.collection.aggregate-let`. - - .. versionadded:: 5.0 + + @@ -616,26 +601,3 @@ An application can encode any arbitrary information in the comment in order to more easily trace or identify specific operations through the system. For instance, an application might attach a string comment incorporating its process ID, thread ID, client hostname, and the user who issued the command. - -.. _db.collection.aggregate-let: - -Use Constants in ``let`` -~~~~~~~~~~~~~~~~~~~~~~~~ - -.. versionadded:: 5.0 - -To specify variables that can be accessed elsewhere in the command, use -the :ref:`let ` option. - -.. include:: /includes/let-constants-example.rst - -.. code-block:: javascript - - db.cakeSales.aggregate( - [ - { $match: { - $expr: { $gt: [ "$salesTotal", "$$targetTotal" ] } - } } - ], - { let: { targetTotal: 3000 } } - ) diff --git a/source/reference/method/db.collection.createIndex.txt b/source/reference/method/db.collection.createIndex.txt index 6617cfe7f29..6ec2433bc91 100644 --- a/source/reference/method/db.collection.createIndex.txt +++ b/source/reference/method/db.collection.createIndex.txt @@ -159,10 +159,29 @@ The ``options`` document contains a set of options that controls the creation of the index. Different index types can have additional options specific for that type. -.. versionchanged:: 3.4 +Multiple index options can be specified in the same document. However, +if you specify mutiple option documents the :method:`db.collection.createIndex()` +operation will fail. - Added support for :ref:`collation option - `. +Consider the following :method:`db.collection.createIndex()` operation: + +.. code-block:: javascript + + db.collection.createIndex( + { + "a": 1 + }, + { + unique: true, + sparse: true, + expireAfterSeconds: 3600 + } + ) + +If the options specification had been split into multiple documents +like this: +``{ unique: true }, { sparse: true, expireAfterSeconds: 3600 }`` +the index creation operation would have failed. Options for All Index Types ~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/source/reference/method/db.collection.createIndexes.txt b/source/reference/method/db.collection.createIndexes.txt index 7a5d7c5a6eb..00ae3bbf45b 100644 --- a/source/reference/method/db.collection.createIndexes.txt +++ b/source/reference/method/db.collection.createIndexes.txt @@ -159,7 +159,37 @@ The ``options`` document contains a set of options that control the creation of the indexes. Different index types can have additional options specific for that type. +Multiple index options can be specified in the same document. However, +if you specify mutiple option documents the :method:`db.collection.createIndexes()` +operation will fail. + +Consider the following :method:`db.collection.createIndexes()` operation: + +.. code-block:: javascript + + db.collection.createIndexes( + [ + { + "a": 1 + }, + { + "b": 1 + } + ], + { + unique: true, + sparse: true, + expireAfterSeconds: 3600 + } + ) + +If the options specification had been split into multiple documents +like this: +``{ unique: true }, { sparse: true, expireAfterSeconds: 3600 }`` +the index creation operation would have failed. + .. important:: + When you specify options to :method:`db.collection.createIndexes()`, the options apply to *all* of the specified indexes. For example, if you specify a @@ -167,13 +197,8 @@ options specific for that type. collation. :method:`db.collection.createIndexes()` will return an error if you - attempt to create indexes with incompatible options. Refer to the - options descriptions for more information. - -.. versionchanged:: 3.4 - - Added support for :ref:`collation - `. + attempt to create indexes with incompatible options or too many + arguments. Refer to the option descriptions for more information. Options for All Index Types ~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/source/reference/method/db.collection.findAndModify.txt b/source/reference/method/db.collection.findAndModify.txt index e1c394b587f..dda676f3656 100644 --- a/source/reference/method/db.collection.findAndModify.txt +++ b/source/reference/method/db.collection.findAndModify.txt @@ -86,7 +86,9 @@ Definition - * - ``sort`` + * - .. _findandmodify-method-stable-sorting: + + ``sort`` - document @@ -96,9 +98,13 @@ Definition Starting in MongoDB 4.2 (and 4.0.12+, 3.6.14+, and 3.4.23+), the operation errors if the sort argument is not a document. - - - + + .. include:: /includes/fact-sort-stability.rst + + See :ref:`sort-cursor-stable-sorting` for more information. + + + * - ``remove`` - boolean diff --git a/source/reference/method/db.collection.insertMany.txt b/source/reference/method/db.collection.insertMany.txt index e17bca5bd3e..0d346bf36f9 100644 --- a/source/reference/method/db.collection.insertMany.txt +++ b/source/reference/method/db.collection.insertMany.txt @@ -81,10 +81,12 @@ Definition A document containing: - - A boolean ``acknowledged`` as ``true`` if the operation ran with - :term:`write concern` or ``false`` if write concern was disabled + - An ``acknowledged`` boolean, set to ``true`` if the operation + ran with :term:`write concern` or ``false`` if write concern + was disabled - - An array of ``_id`` for each successfully inserted documents + - An ``insertedIds`` array, containing ``_id`` values for each + successfully inserted document Behaviors --------- diff --git a/source/reference/method/db.createUser.txt b/source/reference/method/db.createUser.txt index 6297a82821f..d9099eabaa8 100644 --- a/source/reference/method/db.createUser.txt +++ b/source/reference/method/db.createUser.txt @@ -234,7 +234,7 @@ command. Behavior -------- -User Id +User ID ~~~~~~~ Starting in version 4.0.9, MongoDB automatically assigns a unique diff --git a/source/reference/method/db.getProfilingStatus.txt b/source/reference/method/db.getProfilingStatus.txt index e1f1e1c9e22..dae1082205b 100644 --- a/source/reference/method/db.getProfilingStatus.txt +++ b/source/reference/method/db.getProfilingStatus.txt @@ -16,3 +16,15 @@ db.getProfilingStatus() :setting:`~operationProfiling.slowOpThresholdMs` setting, and :setting:`~operationProfiling.slowOpSampleRate` setting. + + Starting in MongoDB 4.4.2, you can set a ``filter`` to + control which operations are logged by the profiler. When + set, any configured filters are also returned by + :method:`db.getProfilingStatus()`, along with a ``note`` + explaining filter behavior. + + You can set the profiling filter with either: + + - the :method:`db.setProfilingLevel()` shell method, or + + - the :setting:`operationProfiling.filter` configuration file option. diff --git a/source/reference/method/db.setProfilingLevel.txt b/source/reference/method/db.setProfilingLevel.txt index 52bfbddb1bc..4a5642bd4a4 100644 --- a/source/reference/method/db.setProfilingLevel.txt +++ b/source/reference/method/db.setProfilingLevel.txt @@ -17,15 +17,20 @@ Definition .. method:: db.setProfilingLevel(level, options) - The method configures :ref:`database profiler level - `, the :ref:`slowms - `, and the :ref:`sampleRate - `. + .. versionchanged:: 4.4.2 + + For a :binary:`~bin.mongod` instance, the method enables, disables, + or configures the :doc:`/tutorial/manage-the-database-profiler`. The + profiler captures and records data on the performance of write + operations, cursors, and database commands on a running + :binary:`~bin.mongod` instance. If the profiler is disabled, the + method configures how slow operations are logged to the diagnostic + log. If the :ref:`database profiler level ` is ``1`` or ``2`` (i.e. the :doc:`database profiler ` is enabled), the - :ref:`slowms ` and the + :ref:`slowms `, :ref:`sampleRate ` affect the behavior of both the profiler and the :option:`diagnostic log `. @@ -33,17 +38,26 @@ Definition If the :ref:`database profiler level ` is ``0`` (i.e. :doc:`database profiler ` is disabled), the - :ref:`slowms ` and the - :ref:`sampleRate ` affect - only the diagnostic log. - - Although profiling is unavailable on :binary:`~bin.mongos` instance, - starting in MongoDB 4.0, you can run - :method:`db.setProfilingLevel()` on :binary:`~bin.mongos` to set the :ref:`slowms ` and - :ref:`sampleRate ` for the - diagnostic log. That is, for a :binary:`~bin.mongos` instance, you - must specify ``0`` for :ref:`level `. + :ref:`sampleRate `, affect + only the diagnostic log. + + (*Starting in MongoDB 4.0*): For a :binary:`~bin.mongos` instance, + the method sets the ``slowms``, ``sampleRate`` and ``filter`` + configuration settings, which configure how operations get written to + the diagnostic log. You cannot enable the + :doc:`/tutorial/manage-the-database-profiler` on a + :binary:`~bin.mongos` instance because ``mongos`` does not have any + collections that the profiler can write to. The ``profile`` level + must be ``0`` for a :binary:`~bin.mongos` instance. + + Starting in MongoDB 4.4.2, you can specify a :ref:`filter + ` on both :binary:`~bin.mongod` + and :binary:`~bin.mongos` instances to control which operations are + logged by the profiler. When you specify a ``filter`` for the + profiler, the :ref:`slowms `, and + :ref:`sampleRate ` options + are not used for profiling and slow-query log lines. :method:`db.setProfilingLevel()` provides a wrapper around the :dbcommand:`profile` command. @@ -143,6 +157,38 @@ Parameters This argument affects the same setting as the configuration option :setting:`~operationProfiling.slowOpSampleRate`. + * - :ref:`filter ` + + - .. _set-profiling-level-options-filter: + + Type: object + + A filter expression that controls which operations are + profiled and logged. The field in the filter expression + can be :ref:`any field in the profiler output `. + + For :binary:`~bin.mongod` instances, the setting affects both the + diagnostic log and, if enabled, the profiler. + + For :binary:`~bin.mongos` instances, the setting affects the + diagnostic log only and not the profiler since profiling is not + available on :binary:`~bin.mongos`. + + For an example of a filter used to control logged + operations, see :ref:`profiler-filter-example`. + + .. versionadded:: 4.4.2 + + .. note:: + + When a profiling :ref:`filter + ` is set, the + :ref:`slowms ` and + :ref:`sampleRate + ` options do + not affect the diagnostic log or the profiler. + + Returns ~~~~~~~ @@ -156,7 +202,27 @@ the settings. .. code-block:: javascript - { "was" : 0, "slowms" : 100, "sampleRate" : 1, "ok" : 1 } + { + "was" : 2, + "slowms" : 100, + "sampleRate" : 1, + "filter" : { + "$and" : [ + { + "op" : { + "$eq" : "query" + } + }, + { + "millis" : { + "$gt" : 20000 + } + } + ] + }, + "note" : "When a filter expression is set, slowms and sampleRate are not used for profiling and slow-query log lines.", + "ok" : 1 + } .. tab:: Replica Set Member :tabid: repl-set @@ -167,6 +233,21 @@ the settings. "was" : 0, "slowms" : 100, "sampleRate" : 1, + "filter" : { + "$and" : [ + { + "op" : { + "$eq" : "query" + } + }, + { + "millis" : { + "$gte" : 2000 + } + } + ] + }, + "note" : "When a filter expression is set, slowms and sampleRate are not used for profiling and slow-query log lines.", "ok" : 1, "$clusterTime" : { "clusterTime" : Timestamp(1572991238, 1), @@ -187,6 +268,21 @@ the settings. "was" : 0, "slowms" : 100, "sampleRate" : 1, + "filter" : { + "$and" : [ + { + "op" : { + "$eq" : "query" + } + }, + { + "millis" : { + "$gte" : 2000 + } + } + ] + }, + "note" : "When a filter expression is set, slowms and sampleRate are not used for profiling and slow-query log lines.", "ok" : 1, "operationTime" : Timestamp(1572991499, 2), "$clusterTime" : { @@ -209,6 +305,20 @@ Where: - ``sampleRate`` is the **previous** :ref:`sampleRate ` setting. +- ``filter`` is the **previous** :ref:`filter + ` setting. + (*New in MongoDB 4.4.2*) + +- ``note`` is a string explaining the behavior of ``filter``. This field + only appears in the output when ``filter`` is also present. + (*New in MongoDB 4.4.2*) + +.. note:: + + The ``filter`` and ``note`` fields only appear in the output if + they were present in the previous :ref:`level + ` setting. + To view the current profiling level, see :method:`db.getProfilingStatus()`. Behavior @@ -263,3 +373,27 @@ The method returns a document with the **previous** values for the settings. To view the current profiling level, see :method:`db.getProfilingStatus()`. + +.. _profiler-filter-example: + +Set a Filter to Determine Profiled Operations +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. versionadded:: 4.4.2 + +The following example sets for a :binary:`~bin.mongod` instance: + +- the :ref:`profiling level ` to ``2``, + +- a :ref:`filter ` of + ``{ op: "query", millis: { $gt: 2000 } }``, which causes the profiler + to only record ``query`` operations that took longer than 2 seconds. + +.. code-block:: javascript + + db.setProfilingLevel( 2, { filter: { op: "query", millis: { $gt: 2000 } } } ) + +The method returns a document with the **previous** values for the +settings. + +To view the current profiling level, see :method:`db.getProfilingStatus()`. diff --git a/source/reference/method/pwd.txt b/source/reference/method/pwd.txt index e7e6e1d8afb..2e7dfc2abcf 100644 --- a/source/reference/method/pwd.txt +++ b/source/reference/method/pwd.txt @@ -12,7 +12,5 @@ pwd() .. method:: pwd() - Returns the current directory. - - This function returns with output relative to the current shell - session, and does not impact the server. + Returns the current working directory of the active shell session, + and does not impact the server. diff --git a/source/reference/method/sh.addShard.txt b/source/reference/method/sh.addShard.txt index 72315efa239..4907469f04b 100644 --- a/source/reference/method/sh.addShard.txt +++ b/source/reference/method/sh.addShard.txt @@ -96,3 +96,7 @@ one member of the replica set: .. code-block:: javascript sh.addShard("repl0/mongodb3.example.net:27327") + +.. seealso:: + + - :command:`addShard` diff --git a/source/reference/operator/aggregation-pipeline.txt b/source/reference/operator/aggregation-pipeline.txt index 0015f9e681a..3a16d04f19f 100644 --- a/source/reference/operator/aggregation-pipeline.txt +++ b/source/reference/operator/aggregation-pipeline.txt @@ -240,7 +240,7 @@ Alphabetical Listing of Stages * - :pipeline:`$sample` - Randomly selects the specified number of documents from its input. - + * - :pipeline:`$set` diff --git a/source/reference/operator/aggregation.txt b/source/reference/operator/aggregation.txt index 65f93e3fbee..3cccf8d4bf8 100644 --- a/source/reference/operator/aggregation.txt +++ b/source/reference/operator/aggregation.txt @@ -82,6 +82,12 @@ Literal Expression Operator .. include:: /includes/extracts/agg-operators-literal.rst +Miscellaneous Operators +~~~~~~~~~~~~~~~~~~~~~~~ + +.. include:: /includes/extracts/agg-operators-miscellaneous.rst + + Object Expression Operators ~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -301,6 +307,10 @@ Alphabetical Listing of Expression Operators - Returns the cosine of a value that is measured in radians. + * - :expression:`$cosh` + + - Returns the hyperbolic cosine of a value that is measured in + radians. * - :expression:`$dateFromParts` @@ -641,7 +651,13 @@ Alphabetical Listing of Expression Operators * - :expression:`$radiansToDegrees` - Converts a value from radians to degrees. - + + + * - :expression:`$rand` + + - Returns a random float between 0 and 1. + + .. versionadded:: 4.4.2 * - :expression:`$range` @@ -703,8 +719,17 @@ Alphabetical Listing of Expression Operators * - :expression:`$rtrim` - Removes whitespace or the specified characters from the end of a string. - + + * - :expression:`$sampleRate` + + - Randomly select documents at a given rate. Although the exact + number of documents selected varies on each run, the quantity + chosen approximates the sample rate expressed as a percentage + of the total number of documents. + + .. versionadded:: 4.4.2 + * - :expression:`$second` - Returns the seconds for a date as a number between 0 and 60 @@ -755,6 +780,10 @@ Alphabetical Listing of Expression Operators - Returns the sine of a value that is measured in radians. + * - :expression:`$sinh` + + - Returns the hyperbolic sine of a value that is measured in + radians. * - :expression:`$slice` @@ -859,7 +888,12 @@ Alphabetical Listing of Expression Operators * - :expression:`$tan` - Returns the tangent of a value that is measured in radians. - + + + * - :expression:`$tanh` + + - Returns the hyperbolic tangent of a value that is measured in + radians. * - :expression:`$toBool` @@ -974,6 +1008,7 @@ Alphabetical Listing of Expression Operators /reference/operator/aggregation/cond /reference/operator/aggregation/convert /reference/operator/aggregation/cos + /reference/operator/aggregation/cosh /reference/operator/aggregation/dateFromParts /reference/operator/aggregation/dateToParts /reference/operator/aggregation/dateFromString @@ -1030,6 +1065,7 @@ Alphabetical Listing of Expression Operators /reference/operator/aggregation/pow /reference/operator/aggregation/push /reference/operator/aggregation/radiansToDegrees + /reference/operator/aggregation/rand /reference/operator/aggregation/range /reference/operator/aggregation/reduce /reference/operator/aggregation/regexFind @@ -1040,6 +1076,7 @@ Alphabetical Listing of Expression Operators /reference/operator/aggregation/reverseArray /reference/operator/aggregation/round /reference/operator/aggregation/rtrim + /reference/operator/aggregation/sampleRate /reference/operator/aggregation/second /reference/operator/aggregation/setDifference /reference/operator/aggregation/setEquals @@ -1048,6 +1085,7 @@ Alphabetical Listing of Expression Operators /reference/operator/aggregation/setUnion /reference/operator/aggregation/size /reference/operator/aggregation/sin + /reference/operator/aggregation/sinh /reference/operator/aggregation/slice /reference/operator/aggregation/split /reference/operator/aggregation/sqrt @@ -1063,6 +1101,7 @@ Alphabetical Listing of Expression Operators /reference/operator/aggregation/sum /reference/operator/aggregation/switch /reference/operator/aggregation/tan + /reference/operator/aggregation/tanh /reference/operator/aggregation/toBool /reference/operator/aggregation/toDate /reference/operator/aggregation/toDecimal diff --git a/source/reference/operator/aggregation/cos.txt b/source/reference/operator/aggregation/cos.txt index ccf8b298a44..71dd7b4239e 100644 --- a/source/reference/operator/aggregation/cos.txt +++ b/source/reference/operator/aggregation/cos.txt @@ -142,7 +142,7 @@ Example :expression:`$cos` is a 128-bit decimal. - id: radians - name: Sine of Value in Radians + name: Cosine of Value in Radians content: | The ``trigonometry`` collection contains a document that diff --git a/source/reference/operator/aggregation/cosh.txt b/source/reference/operator/aggregation/cosh.txt new file mode 100644 index 00000000000..acfc0051230 --- /dev/null +++ b/source/reference/operator/aggregation/cosh.txt @@ -0,0 +1,170 @@ +=================== +$cosh (aggregation) +=================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +.. expression:: $cosh + + .. versionadded:: 4.2 + + Returns the hyperbolic cosine of a value that is measured in radians. + + :expression:`$cosh` has the following syntax: + + .. code-block:: javascript + + { $cosh: } + + :expression:`$cosh` takes any valid :ref:`expression + ` that resolves to a number, measured in + radians. If the expression returns a value in degrees, use the + :expression:`$degreesToRadians` operator to convert the value to + radians. + + By default :expression:`$cosh` returns values as a ``double``. + :expression:`$cosh` can also return values as a :ref:`128-bit decimal + ` if the ```` resolves to a 128-bit + decimal value. + + For more information on expressions, see + :ref:`aggregation-expressions`. + +Behavior +-------- + +``null``, ``NaN``, and ``+/- Infinity`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +If the input argument resolves to a value of ``null`` or refers to a +field that is missing, :expression:`$cosh` returns ``null``. If the +argument resolves to ``NaN``, :expression:`$cosh` returns ``NaN``. If +the argument resolves to negative or positive ``Infinity``, +:expression:`$cosh` returns positive ``Infinity``. + +.. list-table:: + :header-rows: 1 + :widths: 50 50 + + * - Example + - Results + + * - ``{ $cosh: NaN }`` + - ``NaN`` + + * - ``{ $cosh: null }`` + - ``null`` + + * - ``{ $cosh: -Infinity }`` + - ``Infinity`` + + * - ``{ $cosh: Infinity }`` + - ``Infinity`` + +Example +------- + +.. tabs:: + + tabs: + + - id: degrees + name: Hyperbolic Cosine of Value in Degrees + content: | + + The following ``trigonometry`` collection contains a document + that stores an ``angle`` value measured in degrees: + + .. code-block:: javascript + + db.trigonometry.insertOne( + { + "_id" : ObjectId( "5c50782193f833234ba90d85" ), + "angle" : NumberDecimal( "53.1301023541559787031443874490659" ) + } + ) + + The following aggregation operation uses the + :expression:`$cosh` expression to calculate the hyperbolic + cosine of ``angle`` and adds it to the input document using the + :pipeline:`$addFields` pipeline stage: + + .. code-block:: javascript + + db.trigonometry.aggregate( [ + { + $addFields : { + "cosh_output" : { $cosh : { $degreesToRadians : "$angle" } } + } + } + ] ) + + The :expression:`$degreesToRadians` expression converts the + ``angle`` in degrees to radians. + + Example output: + + .. code-block:: javascript + :copyable: false + + { + "_id" : ObjectId("5c50782193f833234ba90d85"), + "angle" : NumberDecimal("53.1301023541559787031443874490659"), + "cosh_output" : NumberDecimal("1.461642741099671277595921778079396") + } + + Because ``angle`` is stored as a :ref:`128-bit decimal + `, the :expression:`$cosh` output is also a + 128-bit decimal. + + - id: radians + name: Hyperbolic Cosine of Value in Radians + content: | + + The following ``trigonometry`` collection contains a document + that stores an ``angle`` value measured in radians: + + .. code-block:: javascript + + db.trigonometry.insertOne( + { + "_id" : ObjectId( "5c50782193f833234ba90d15" ), + "angle" : NumberDecimal( "1.6301023541559787031443874490659" ) + } + ) + + The following aggregation operation uses the + :expression:`$cosh` expression to calculate the hyperbolic + cosine of ``angle`` and adds it to the input document using + the :pipeline:`$addFields` pipeline stage: + + .. code-block:: javascript + + db.trigonometry.aggregate( [ + { + $addFields : { + "cosh_output" : { $cosh : "$angle" } + } + } + ] ) + + Example output: + + .. code-block:: javascript + :copyable: false + + { + "_id" : ObjectId("5c50782193f833234ba90d15"), + "angle" : NumberDecimal("1.6301023541559787031443874490659"), + "cosh_output" : NumberDecimal("2.650153334504361016712328539738000") + } + + Because ``angle`` is stored as a :ref:`128-bit decimal + `, the :expression:`$cosh` output is also + a 128-bit decimal. diff --git a/source/reference/operator/aggregation/limit.txt b/source/reference/operator/aggregation/limit.txt index b55ccc26bfc..af90d3ceb83 100644 --- a/source/reference/operator/aggregation/limit.txt +++ b/source/reference/operator/aggregation/limit.txt @@ -27,6 +27,36 @@ Definition :pipeline:`$limit` takes a positive integer that specifies the maximum number of documents to pass along. +Behavior +-------- + +Using $limit with Sorted Results +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +If using the :pipeline:`$limit` stage with any of: + +- the :pipeline:`$sort` aggregation stage, +- the :method:`~cursor.sort()` method, or +- the ``sort`` field to the :dbcommand:`findAndModify` command or the + :method:`~db.collection.findAndModify()` shell method. + +be sure that you are performing a *stable sort* before passing results +to the :pipeline:`$limit` stage. A stable sort ensures that the sort +order of returned documents remains the same across multiple executions +of the same sort; especially important when used with the +:pipeline:`$limit` stage. + +See the following for more information on each: + +- :ref:`Stable sorting with $sort (aggregation) + ` +- :ref:`Stable sorting with the sort() method + ` +- :ref:`Stable sorting with the findAndModify command + ` +- :ref:`Stable sorting with the findAndModify() method + ` + Example ------- diff --git a/source/reference/operator/aggregation/rand.txt b/source/reference/operator/aggregation/rand.txt new file mode 100644 index 00000000000..600d546937d --- /dev/null +++ b/source/reference/operator/aggregation/rand.txt @@ -0,0 +1,171 @@ +=================== +$rand (aggregation) +=================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Definition +---------- + +.. expression:: $rand + + .. versionadded:: 4.4.2 + + Returns a random float between 0 and 1 each time it is called. + + :expression:`$rand` has the following syntax: + + .. code-block:: javascript + + { $rand: {} } + + The :expression:`$rand` operator doesn't take any arguments. + +Behavior +-------- +Each time ``$rand`` is called it will return a floating point value +that has up to 17 digits after the decimal point. Trailing 0s are +dropped so the actual number of digits may vary. + +Examples +-------- + +This code initializes a ``randomSamples`` collection with 100 documents +that is used in the following examples. + +.. code-block:: javascript + + N = 100 + bulk = db.randomSamples.initializeUnorderedBulkOp() + for ( i = 0; i < N; i++) { bulk.insert( {_id: i, random: 0 } ) } + bulk.execute() + + +Usage with Update Queries +~~~~~~~~~~~~~~~~~~~~~~~~~ + +The ``$rand`` operator can be used with update query operations. In +this example :method:`~db.collection.updateMany()` uses the ``$rand`` +operator to insert a different random number into each document +in the ``randomSamples`` collection. + +.. code-block:: javascript + + db.randomSamples.updateMany( + {}, + [ + { $set: { "random": { $rand: {} } } } + ] + ) + +We can use :pipeline:`$project` to see the output. The +:pipeline:`$limit` stage halts the pipeline after the third document. + +.. code-block:: javascript + + db.randomSamples.aggregate( + [ + { $project: {_id: 0, random: 1 } }, + { $limit: 3 } + ] + ) + +The output shows the random values. + +.. code-block:: javascript + :copyable: false + + { "random" : 0.8751284485870464 } + { "random" : 0.515147067802108 } + { "random" : 0.3750004525681561 } + +Rounding to Control the Number of Output Digits +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +If you want a shorter random value, consider using :expression:`$round`. +Note that the :pipeline:`$set` stage updates the document, if ``$rand`` +is called in a :pipeline:`$project` stage the underlying document is +not modified. + +.. code-block:: javascript + + db.randomSamples.aggregate( + [ + { $match: {} }, + { $set: { rounded: { $round: [ "$random", 4 ] } } }, + { $out: "randomSamples" } + ] + ) + +The :pipeline:`$project` stage displays the original and rounded value +for each document. + +.. code-block:: javascript + + db.randomSamples.aggregate( + [ + { $project: {_id:0, random:1, rounded: 1 } }, + { $limit: 3 } + ] + ) + +The update documents look like this: + +.. code-block:: javascript + :copyable: false + + { "random" : 0.8751284485870464, "rounded" : 0.8751 } + { "random" : 0.515147067802108, "rounded" : 0.5151 } + { "random" : 0.3750004525681561, "rounded" : 0.375 } + +.. note:: + + Like ``$rand``, the value returned by the ``$round`` operator does + not include any trailing 0s so the number of digits returned may + vary. + +Selecting Random Items From a Collection +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The ``$rand`` operator can be used in an aggregation pipeline to select +random documents from a collection. In this example we use ``$rand`` to +select about half the documents in the ``randomSamples`` collection. + +.. code-block:: javascript + + db.randomSamples.aggregate( + [ + { $match: { $expr: { $lt: [0.5, {$rand: {} } ] } } }, + { $count: "numMatches" } + ] + ) + +There are 100 documents in ``randomSamples``. Running the sample code 5 +times produces the following output which approaches the expected value +of 50 matches in a collection this size. + +.. code-block:: javascript + :copyable: false + + { "numMatches" : 49 } + { "numMatches" : 52 } + { "numMatches" : 54 } + { "numMatches" : 48 } + { "numMatches" : 59 } + +.. note:: + + This example shows that the number of documents selected is + different each time. If you need to select an exact number of + documents, consider using :pipeline:`$sample` instead of ``$rand``. + +.. seealso:: + + :query:`$rand (query) <$rand>`, :pipeline:`$sample`, :expression:`$round` + diff --git a/source/reference/operator/aggregation/round.txt b/source/reference/operator/aggregation/round.txt index fc089b4f624..5307782e2d1 100644 --- a/source/reference/operator/aggregation/round.txt +++ b/source/reference/operator/aggregation/round.txt @@ -90,33 +90,64 @@ Definition Behavior -------- -Rounding to Even Values -~~~~~~~~~~~~~~~~~~~~~~~ +Rounding Numbers Ending in 5 +~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -When rounding on a value of ``5``, :expression:`$round` rounds to the -nearest even value. For example, consider the following sample -documents: +To minimize the skew errors that are caused by always rounding upwards, +numbers ending in 5 are rounded to the nearest even value. This is the +`IEEE standard `__ +for floating point numbers and also works well operations across +sequences. -.. code-block:: javascript +For example, consider this chart: - {_id : 1, "value" : 10.5}, - {_id : 2, "value" : 11.5}, - {_id : 3, "value" : 12.5}, - {_id : 4, "value" : 13.5} - -:expression:`$round : [ "$value", 0] <$round>` returns the following: - -.. code-block:: javascript - - {_id : 1, "value" : 10}, - {_id : 2, "value" : 12}, - {_id : 3, "value" : 12}, - {_id : 4, "value" : 14} - -The value ``10.5`` is closest to the even value ``10``, while the values -``11.5`` and ``12.5`` are closest to the even value ``12``. Rounding to -the nearest even value supports more even distribution of rounded data -than always rounding up or down. +.. list-table:: + :header-rows: 1 + :widths: 25 25 25 25 + + * - Original + - Rounded 1 + - Rounded 0 + - Rounded -1 + + * - 124.5 + - 124.5 + - 124 + - 120 + + * - 125.5 + - 125.5 + - 126 + - 130 + + * - 25 + - 25 + - 25 + - 20 + + * - 12.5 + - 12.5 + - 12 + - 10 + + * - 2.25 + - 2.2 + - 2 + - 0 + + * - 2.45 + - 2.5 + - 2 + - 0 + +The chart highlights a few points. + +- The ``$round`` function is not limited to floats. (``25`` becomes ``20``). +- Rounded numbers can still end in 5 (``2.45`` becomes ``2.5``) +- The rounded value is determined by more than one digit + +For further discussion of the 'Round Half to Even' technique, see +`this article `__. Returned Data Type ~~~~~~~~~~~~~~~~~~ diff --git a/source/reference/operator/aggregation/sample.txt b/source/reference/operator/aggregation/sample.txt index 1ce09b3af4a..c6d1e9ac7bd 100644 --- a/source/reference/operator/aggregation/sample.txt +++ b/source/reference/operator/aggregation/sample.txt @@ -74,3 +74,8 @@ collection: ) The operation returns three random documents. + +.. seealso:: + + :expression:`$rand (aggregation) <$rand>` + diff --git a/source/reference/operator/aggregation/sampleRate.txt b/source/reference/operator/aggregation/sampleRate.txt new file mode 100644 index 00000000000..4f07e6650e3 --- /dev/null +++ b/source/reference/operator/aggregation/sampleRate.txt @@ -0,0 +1,104 @@ +========================= +$sampleRate (aggregation) +========================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Definition +---------- + +.. expression:: $sampleRate + + .. versionadded:: 4.4.2 + + Matches a random selection of input documents. The number of + documents selected approximates the sample rate expressed as a + percentage of the total number of documents. + + The :expression:`$sampleRate` operator has the following syntax: + + .. code-block:: javascript + + { $sampleRate: } + +Behavior +-------- + +The selection process uses a uniform random distribution. The sample +rate is a floating point number between 0 and 1, inclusive, which +represents the probability that a given document will be selected as it +passes through the pipeline. + +For example, a sample rate of ``0.33`` selects roughly one document in +three. + +This expression: + +.. code-block:: javascript + + { $match: { $sampleRate: 0.33 } } + +is equivalent to using the :expression:`$rand` operator as follows: + +.. code-block:: javascript + + { $match: { $expr: { $lt: [ { $rand: {} }, 0.33 ] } } } + +Repeated runs on the same data will produce different outcomes since +the selection process is non-deterministic. In general, smaller +datasets will show more variability in the number of documents +selected on each run. As collection size increases, the number of +documents chosen will approach the expected value for a uniform random +distribution. + +.. note:: + + If an exact number of documents is required from each run, the + :pipeline:`$sample` operator should be used instead of ``$sampleRate``. + +Examples +-------- + +This code creates a small collection with 100 documents. + +.. code-block:: javascript + + N = 100 + bulk = db.collection.initializeUnorderedBulkOp() + for ( i = 0; i < N; i++) { bulk.insert( {_id: i, r: 0} ) } + bulk.execute() + +The ``$sampleRate`` operator can be used in a pipeline to select random +documents from the collection. In this example we use ``$sampleRate`` +to select about one third of the documents. + +.. code-block:: javascript + + db.collection.aggregate( + [ + { $match: { $sampleRate: 0.33 } }, + { $count: "numMatches" } + ] + ) + +This is the output from 5 runs on the sample collection: + +.. code-block:: javascript + :copyable: false + + { "numMatches" : 38 } + { "numMatches" : 36 } + { "numMatches" : 29 } + { "numMatches" : 29 } + { "numMatches" : 28 } + +.. seealso:: + + :pipeline:`$sample`, :query:`$rand`. + diff --git a/source/reference/operator/aggregation/setIntersection.txt b/source/reference/operator/aggregation/setIntersection.txt index 32351fcd6d3..da8061c3911 100644 --- a/source/reference/operator/aggregation/setIntersection.txt +++ b/source/reference/operator/aggregation/setIntersection.txt @@ -36,6 +36,9 @@ Behavior .. include:: /includes/important-set-operator-semantics.rst +If no intersections are found (i.e. the input arrays contain no common +elements), :expression:`$setIntersection` returns an empty array. + .. include:: /includes/extracts/fact-agg-top-level-expressions-setIntersection.rst .. list-table:: diff --git a/source/reference/operator/aggregation/sinh.txt b/source/reference/operator/aggregation/sinh.txt new file mode 100644 index 00000000000..b8e50d8c485 --- /dev/null +++ b/source/reference/operator/aggregation/sinh.txt @@ -0,0 +1,171 @@ +=================== +$sinh (aggregation) +=================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +.. expression:: $sinh + + .. versionadded:: 4.2 + + Returns the hyperbolic sine of a value that is measured in radians. + + :expression:`$sinh` has the following syntax: + + .. code-block:: javascript + + { $sinh: } + + :expression:`$sinh` takes any valid :ref:`expression + ` that resolves to a number, measured in + radians. If the expression returns a value in degrees, use the + :expression:`$degreesToRadians` operator to convert the value to + radians. + + By default :expression:`$sinh` returns values as a ``double``. + :expression:`$sinh` can also return values as a :ref:`128-bit decimal + ` if the ```` resolves to a 128-bit + decimal value. + + For more information on expressions, see + :ref:`aggregation-expressions`. + +Behavior +-------- + +``null``, ``NaN``, and ``+/- Infinity`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +If the input argument resolves to a value of ``null`` or refers to a +field that is missing, :expression:`$sinh` returns ``null``. If the +argument resolves to ``NaN``, :expression:`$sinh` returns ``NaN``. If +the argument resolves to negative or positive ``Infinity``, +:expression:`$sinh` returns negative or positive ``Infinity`` +respectively. + +.. list-table:: + :header-rows: 1 + :widths: 50 50 + + * - Example + - Results + + * - ``{ $sinh: NaN }`` + - ``NaN`` + + * - ``{ $sinh: null }`` + - ``null`` + + * - ``{ $sinh: -Infinity }`` + - ``-Infinity`` + + * - ``{ $sinh: Infinity }`` + - ``Infinity`` + +Example +------- + +.. tabs:: + + tabs: + + - id: degrees + name: Hyperbolic Sine of Value in Degrees + content: | + + The following ``trigonometry`` collection contains a document + that stores an ``angle`` value measured in degrees: + + .. code-block:: javascript + + db.trigonometry.insertOne( + { + "_id" : ObjectId( "5c50782193f833234ba90d25" ), + "angle" : NumberDecimal( "53.1301023541559787031443874490659" ) + } + ) + + The following aggregation operation uses the + :expression:`$sinh` expression to calculate the hyperbolic sine + of ``angle`` and adds it to the input document using the + :pipeline:`$addFields` pipeline stage: + + .. code-block:: javascript + + db.trigonometry.aggregate( [ + { + $addFields : { + "sinh_output" : { $sinh : { $degreesToRadians : "$angle" } } + } + } + ] ) + + The :expression:`$degreesToRadians` expression converts the + ``angle`` in degrees to radians. + + Example output: + + .. code-block:: javascript + :copyable: false + + { + "_id" : ObjectId("5c50782193f833234ba90d25"), + "angle" : NumberDecimal("53.1301023541559787031443874490659"), + "sinh_output" : NumberDecimal("1.066020404405732132503284522731829") + } + + Because ``angle`` is stored as a :ref:`128-bit decimal + `, the :expression:`$sinh` output is also a + 128-bit decimal. + + - id: radians + name: Hyperbolic Sine of Value in Radians + content: | + + The following ``trigonometry`` collection contains a document + that stores an ``angle`` value measured in radians: + + .. code-block:: javascript + + db.trigonometry.insertOne( + { + "_id" : ObjectId( "5c50782193f833234ba90d35" ), + "angle" : NumberDecimal( "1.6301023541559787031443874490659" ) + } + ) + + The following aggregation operation uses the + :expression:`$sinh` expression to calculate the hyperbolic sine + of ``angle`` and adds it to the input document using the + :pipeline:`$addFields` pipeline stage: + + .. code-block:: javascript + + db.trigonometry.aggregate( [ + { + $addFields : { + "sinh_output" : { $sinh : "$angle" } + } + } + ] ) + + Example output: + + .. code-block:: javascript + :copyable: false + + { + "_id" : ObjectId("5c50782193f833234ba90d35"), + "angle" : NumberDecimal("1.6301023541559787031443874490659"), + "sinh_output" : NumberDecimal("2.454243813557362033961729701069671") + } + + Because ``angle`` is stored as a :ref:`128-bit decimal + `, the :expression:`$sinh` output is also + a 128-bit decimal. diff --git a/source/reference/operator/aggregation/skip.txt b/source/reference/operator/aggregation/skip.txt index 3f1b73e9336..1edc97b9a33 100644 --- a/source/reference/operator/aggregation/skip.txt +++ b/source/reference/operator/aggregation/skip.txt @@ -28,6 +28,36 @@ Definition :pipeline:`$skip` takes a positive integer that specifies the maximum number of documents to skip. +Behavior +-------- + +Using $skip with Sorted Results +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +If using the :pipeline:`$skip` stage with any of: + +- the :pipeline:`$sort` aggregation stage, +- the :method:`~cursor.sort()` method, or +- the ``sort`` field to the :dbcommand:`findAndModify` command or the + :method:`~db.collection.findAndModify()` shell method. + +be sure that you are performing a *stable sort* before passing results +to the :pipeline:`$skip` stage. A stable sort ensures that the sort +order of returned documents remains the same across multiple executions +of the same sort; especially important when used with the +:pipeline:`$skip` stage. + +See the following for more information on each: + +- :ref:`Stable sorting with $sort (aggregation) + ` +- :ref:`Stable sorting with the sort() method + ` +- :ref:`Stable sorting with the findAndModify command + ` +- :ref:`Stable sorting with the findAndModify() method + ` + Example ------- diff --git a/source/reference/operator/aggregation/sort.txt b/source/reference/operator/aggregation/sort.txt index cccb9489171..d0bc5567935 100644 --- a/source/reference/operator/aggregation/sort.txt +++ b/source/reference/operator/aggregation/sort.txt @@ -52,6 +52,83 @@ Definition ````. Then documents with the same ```` values are further sorted by ````. +Behavior +-------- + +.. _sort-aggregation-stable-sorting: + +Sort Stability +~~~~~~~~~~~~~~ + +.. include:: /includes/fact-sort-stability.rst + +Consider the following ``restaurant`` collection: + +.. code-block:: js + + db.restaurants.insertMany( [ + { "_id" : 1, "name" : "Central Park Cafe", "borough" : "Manhattan"}, + { "_id" : 2, "name" : "Rock A Feller Bar and Grill", "borough" : "Queens"}, + { "_id" : 3, "name" : "Empire State Pub", "borough" : "Brooklyn"}, + { "_id" : 4, "name" : "Stan's Pizzaria", "borough" : "Manhattan"}, + { "_id" : 5, "name" : "Jane's Deli", "borough" : "Brooklyn"}, + ] ); + +The following command uses the :pipeline:`$sort` stage to sort on +the ``borough`` field: + +.. code-block:: js + + db.restaurants.aggregate( + [ + { $sort : { borough : 1 } } + ] + ) + +In this example, the sort is *unstable*, since the ``borough`` field +contains duplicate values for both ``Manhattan`` and ``Brooklyn``. +Documents are returned in alphabetical order by ``borough``, but the +order of those documents with duplicate values for ``borough`` might not +the be the same across multiple executions of the same sort. For +example, here are the results from two different executions of the +above command: + +.. code-block:: js + :copyable: false + + { "_id" : 3, "name" : "Empire State Pub", "borough" : "Brooklyn" } + { "_id" : 5, "name" : "Jane's Deli", "borough" : "Brooklyn" } + { "_id" : 1, "name" : "Central Park Cafe", "borough" : "Manhattan" } + { "_id" : 4, "name" : "Stan's Pizzaria", "borough" : "Manhattan" } + { "_id" : 2, "name" : "Rock A Feller Bar and Grill", "borough" : "Queens" } + + { "_id" : 5, "name" : "Jane's Deli", "borough" : "Brooklyn" } + { "_id" : 3, "name" : "Empire State Pub", "borough" : "Brooklyn" } + { "_id" : 4, "name" : "Stan's Pizzaria", "borough" : "Manhattan" } + { "_id" : 1, "name" : "Central Park Cafe", "borough" : "Manhattan" } + { "_id" : 2, "name" : "Rock A Feller Bar and Grill", "borough" : "Queens" } + +While the values for ``borough`` are still sorted in alphabetical order, +the order of the documents containing duplicate values for ``borough`` +(i.e. ``Manhattan`` and ``Brooklyn``) is not the same. + +To achieve a *stable sort*, add a field which contains exclusively +unique values to the sort. The following command uses the +:pipeline:`$sort` stage to sort on both the ``borough`` field and the +``_id`` field: + +.. code-block:: js + + db.restaurants.aggregate( + [ + { $sort : { borough : 1, _id: 1 } } + ] + ) + +Since the ``_id`` field is always guaranteed to contain exclusively +unique values, the returned sort order will always be the same across +multiple executions of the same sort. + Examples -------- diff --git a/source/reference/operator/aggregation/substrCP.txt b/source/reference/operator/aggregation/substrCP.txt index 5cc29e33564..3d1b5bc88d5 100644 --- a/source/reference/operator/aggregation/substrCP.txt +++ b/source/reference/operator/aggregation/substrCP.txt @@ -90,7 +90,7 @@ Definition - ``"cafét"`` * - ``{ $substrCP: [ "cafétéria", 5, 4 ] }`` - - ``"tér"`` + - ``"éria"`` * - ``{ $substrCP: [ "cafétéria", 7, 3 ] }`` - ``"ia"`` @@ -199,4 +199,4 @@ The operation returns the following results: { "_id" : 7, "name" : "tacos", "menuCode" : "tac" } { "_id" : 8, "name" : "寿司sushi", "menuCode" : "寿司s" } -.. seealso:: :expression:`$substrBytes` \ No newline at end of file +.. seealso:: :expression:`$substrBytes` diff --git a/source/reference/operator/aggregation/tanh.txt b/source/reference/operator/aggregation/tanh.txt new file mode 100644 index 00000000000..67ffb41264e --- /dev/null +++ b/source/reference/operator/aggregation/tanh.txt @@ -0,0 +1,171 @@ +=================== +$tanh (aggregation) +=================== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +.. expression:: $tanh + + .. versionadded:: 4.2 + + Returns the hyperbolic tangent of a value that is measured in + radians. + + :expression:`$tanh` has the following syntax: + + .. code-block:: javascript + + { $tanh: } + + :expression:`$tanh` takes any valid :ref:`expression + ` that resolves to a number, measured in + radians. If the expression returns a value in degrees, use the + :expression:`$degreesToRadians` operator to convert the value to + radians. + + By default :expression:`$tanh` returns values as a ``double``. + :expression:`$tanh` can also return values as a :ref:`128-bit decimal + ` if the ```` resolves to a 128-bit + decimal value. + + For more information on expressions, see + :ref:`aggregation-expressions`. + +Behavior +-------- + +``null``, ``NaN``, and ``+/- Infinity`` +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +If the input argument resolves to a value of ``null`` or refers to a +field that is missing, :expression:`$tanh` returns ``null``. If the +argument resolves to ``NaN``, :expression:`$tanh` returns ``NaN``. If +the argument resolves to negative or positive ``Infinity``, +:expression:`$tanh` returns ``-1`` or ``1`` respectively. + +.. list-table:: + :header-rows: 1 + :widths: 50 50 + + * - Example + - Results + + * - ``{ $tanh: NaN }`` + - ``NaN`` + + * - ``{ $tanh: null }`` + - ``null`` + + * - ``{ $tanh: -Infinity }`` + - ``-1`` + + * - ``{ $tanh: Infinity }`` + - ``1`` + +Example +------- + +.. tabs:: + + tabs: + + - id: degrees + name: Hyperbolic Tangent of Value in Degrees + content: | + + The following ``trigonometry`` collection contains a document + that stores an ``angle`` value measured in degrees: + + .. code-block:: javascript + + db.trigonometry.insertOne( + { + "_id" : ObjectId( "5c50782193f833234ba90d45" ), + "angle" : NumberDecimal( "53.1301023541559787031443874490659" ) + } + ) + + The following aggregation operation uses the + :expression:`$tanh` expression to calculate the hyperbolic + tangent of ``angle`` and adds it to the input document using + the :pipeline:`$addFields` pipeline stage: + + .. code-block:: javascript + + db.trigonometry.aggregate( [ + { + $addFields : { + "tanh_output" : { $tanh : { $degreesToRadians : "$angle" } } + } + } + ] ) + + The :expression:`$degreesToRadians` expression converts the + ``angle`` in degrees to radians. + + Example output: + + .. code-block:: javascript + :copyable: false + + { + "_id" : ObjectId("5c50782193f833234ba90d45"), + "angle" : NumberDecimal("53.1301023541559787031443874490659"), + "tanh_output" : NumberDecimal("0.7293303448445332820512777329448416") + } + + Because ``angle`` is stored as a :ref:`128-bit decimal + `, the :expression:`$tanh` output is also a + 128-bit decimal. + + - id: radians + name: Hyperbolic Tangent of Value in Radians + content: | + + The following ``trigonometry`` collection contains a document + that stores an ``angle`` value measured in radians: + + .. code-block:: javascript + + db.trigonometry.insertOne( + { + "_id" : ObjectId( "5c50782193f833234ba90d55" ), + "angle" : NumberDecimal( "1.6301023541559787031443874490659" ) + } + ) + + The following aggregation operation uses the + :expression:`$tanh` expression to calculate the hyperbolic + tangent of ``angle`` and adds it to the input document using + the :pipeline:`$addFields` pipeline stage: + + .. code-block:: javascript + + db.trigonometry.aggregate( [ + { + $addFields : { + "tanh_output" : { $tanh : "$angle" } + } + } + ] ) + + Example output: + + .. code-block:: javascript + :copyable: false + + { + "_id" : ObjectId("5c50782193f833234ba90d55"), + "angle" : NumberDecimal("1.6301023541559787031443874490659"), + "tanh_output" : NumberDecimal("0.9260761562750713360156803177935379") + } + + Because ``angle`` is stored as a :ref:`128-bit decimal + `, the :expression:`$tanh` output is also + a 128-bit decimal. diff --git a/source/reference/operator/query-miscellaneous.txt b/source/reference/operator/query-miscellaneous.txt new file mode 100644 index 00000000000..aa2fa515843 --- /dev/null +++ b/source/reference/operator/query-miscellaneous.txt @@ -0,0 +1,39 @@ +============================= +Miscellaneous Query Operators +============================= + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +.. include:: /includes/extracts/operators-toc-explanation.rst + +.. list-table:: + :widths: 25,75 + :header-rows: 1 + + * - Name + + - Description + + * - :query:`$comment` + + - Adds a comment to a query predicate. + + * - :query:`$rand` + + - Generates a random float between 0 and 1. + + .. versionadded:: 4.4.2 + + +.. toctree:: + :titlesonly: + :hidden: + + /reference/operator/query/comment + /reference/operator/query/rand diff --git a/source/reference/operator/query.txt b/source/reference/operator/query.txt index efd83e42d26..14f86bbd4bc 100644 --- a/source/reference/operator/query.txt +++ b/source/reference/operator/query.txt @@ -10,6 +10,7 @@ Query and Projection Operators :depth: 1 :class: singlecol + .. include:: /includes/extracts/operators-toc-explanation.rst .. _query-selectors: @@ -23,6 +24,7 @@ Comparison .. only:: website .. include:: /includes/fact-comparison-order.rst + .. list-table:: :widths: 30,70 :header-rows: 1 @@ -299,64 +301,71 @@ Bitwise /reference/operator/query-bitwise -Comments -~~~~~~~~ + +.. _query-projection-operators: + +Projection Operators +-------------------- .. only:: website .. list-table:: - :widths: 30,70 + :widths: 25,75 :header-rows: 1 * - Name - Description - * - :query:`$comment` + * - :projection:`$` - - Adds a comment to a query predicate. + - Projects the first element in an array that matches the query condition. + * - :projection:`$elemMatch` + + - Projects the first element in an array that matches the specified :projection:`$elemMatch` condition. + + * - :projection:`$meta` + + - Projects the document's score assigned during :query:`$text` operation. + + * - :projection:`$slice` + + - Limits the number of elements projected from an array. Supports skip and limit slices. .. toctree:: :titlesonly: :hidden: - /reference/operator/query/comment + /reference/operator/projection -.. _query-projection-operators: +.. _query-miscelaneous-operators: -Projection Operators --------------------- +Miscellaneous Operators +----------------------- .. only:: website .. list-table:: - :widths: 30,70 + :widths: 25,75 :header-rows: 1 * - Name - Description - * - :projection:`$` - - - Projects the first element in an array that matches the query condition. - - * - :projection:`$elemMatch` - - - Projects the first element in an array that matches the specified :projection:`$elemMatch` condition. - - * - :projection:`$meta` - - - Projects the document's score assigned during :query:`$text` operation. + * - :query:`$comment` - * - :projection:`$slice` + - Adds a comment to a query predicate. - - Limits the number of elements projected from an array. Supports skip and limit slices. + * - :query:`$rand` + - Generates a random float between 0 and 1. .. toctree:: :titlesonly: :hidden: - /reference/operator/projection + /reference/operator/query-miscellaneous + + diff --git a/source/reference/operator/query/expr.txt b/source/reference/operator/query/expr.txt index 4a03eea9777..8598f26fd1e 100644 --- a/source/reference/operator/query/expr.txt +++ b/source/reference/operator/query/expr.txt @@ -36,12 +36,12 @@ Behavior - :query:`$expr` can build query expressions that compare fields from the same document in a :pipeline:`$match` stage. - - If the :pipeline:`$match` stage is part of a :pipeline:`$lookup` - stage, :query:`$expr` can compare fields using ``let`` variables. - See :ref:`lookup-multiple-joins` for an example. + - If the :pipeline:`$match` stage is part of a :pipeline:`$lookup` + stage, :query:`$expr` can compare fields using ``let`` variables. + See :ref:`lookup-multiple-joins` for an example. - - :query:`$expr` only uses indexes on the ``from`` collection for - equality matches in a :pipeline:`$match` stage. + - :query:`$expr` only uses indexes on the ``from`` collection for + equality matches in a :pipeline:`$match` stage. - :query:`$expr` does not support :ref:`multikey indexes `. diff --git a/source/reference/operator/query/rand.txt b/source/reference/operator/query/rand.txt new file mode 100644 index 00000000000..c5af1b5fb32 --- /dev/null +++ b/source/reference/operator/query/rand.txt @@ -0,0 +1,65 @@ +===== +$rand +===== + +.. default-domain:: mongodb + +.. contents:: On this page + :local: + :backlinks: none + :depth: 1 + :class: singlecol + +Definition +---------- + +.. query:: $rand + +.. versionadded:: 4.4.2 + +:query:`$rand` returns a random float between 0 and 1. + +:query:`$rand` has the following syntax: + +.. code-block:: javascript + + { $rand: {} } + +Examples +-------- + +This code creates a small collection of 100 documents. We will +use ``$rand`` to select random documents from the collection. + +.. code-block:: javascript + + N = 100 + bulk = db.samples.initializeUnorderedBulkOp() + for (i = 0; i < N; i++) { bulk.insert({_id: i, r: 0}) } + bulk.execute() + +In this example we use ``$rand`` to select about half the documents. + +.. code-block:: javascript + + db.samples.find( + { $expr: { $lt: [0.5, {$rand: {} } ] } } + ).count() + +Running this :dbcommand:`find` operation five times returns five random +values that approach the number 50, which is the expected value for a +collection of this size. For example: + +.. code-block:: javascript + :copyable: false + + 51 + 53 + 49 + 45 + 47 + +.. seealso:: + + :expression:`$rand (aggregation) <$rand>` + diff --git a/source/reference/parameters.txt b/source/reference/parameters.txt index 43b6dde36b7..7a5351164dd 100644 --- a/source/reference/parameters.txt +++ b/source/reference/parameters.txt @@ -272,11 +272,11 @@ Authentication Parameters .. seealso:: - - :parameter:`ocspValidationRefreshPeriodSecs` + - :parameter:`ocspStaplingRefreshPeriodSecs` - :parameter:`tlsOCSPStaplingTimeoutSecs` - :parameter:`tlsOCSPVerifyTimeoutSecs` -.. parameter:: ocspValidationRefreshPeriodSecs +.. parameter:: ocspStaplingRefreshPeriodSecs .. versionadded:: 4.4 @@ -285,14 +285,16 @@ Authentication Parameters The number of seconds to wait before refreshing the stapled OCSP status response. Specify a number greater than or equal to 1. - You can only set :parameter:`ocspValidationRefreshPeriodSecs` during + You can only set :parameter:`ocspStaplingRefreshPeriodSecs` during startup in the :setting:`configuration file ` or with the ``--setParameter`` option on the command line. For example, the following sets the parameter to 3600 seconds: .. code-block:: sh - mongod --setParameter ocspValidationRefreshPeriodSecs=3600 ... + mongod --setParameter ocspStaplingRefreshPeriodSecs=3600 ... + + .. include:: /includes/fact-4.4-stapling-refresh-rename.rst .. seealso:: @@ -573,7 +575,7 @@ Authentication Parameters .. seealso:: - :parameter:`ocspEnabled` - - :parameter:`ocspValidationRefreshPeriodSecs` + - :parameter:`ocspStaplingRefreshPeriodSecs` - :parameter:`tlsOCSPVerifyTimeoutSecs` .. parameter:: tlsOCSPVerifyTimeoutSecs @@ -603,7 +605,7 @@ Authentication Parameters .. seealso:: - :parameter:`ocspEnabled` - - :parameter:`ocspValidationRefreshPeriodSecs` + - :parameter:`ocspStaplingRefreshPeriodSecs` - :parameter:`tlsOCSPStaplingTimeoutSecs` .. parameter:: tlsWithholdClientCertificate diff --git a/source/reference/read-concern.txt b/source/reference/read-concern.txt index 531df5d601c..0a484b6c79f 100644 --- a/source/reference/read-concern.txt +++ b/source/reference/read-concern.txt @@ -500,6 +500,13 @@ of a multi-document transaction: available in transactions. For more information, see :ref:`transactions-read-concern`. +Read Concern not Supported on ``local`` Database +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The :ref:`local database ` does not support +read concerns. MongoDB silently ignores any configured read +concern for an operation on a collection in the local database. + Considerations -------------- diff --git a/source/reference/replica-configuration.txt b/source/reference/replica-configuration.txt index b9277f71dcc..8f0bdb5b7c4 100644 --- a/source/reference/replica-configuration.txt +++ b/source/reference/replica-configuration.txt @@ -195,17 +195,11 @@ Replica Set Configuration Fields *Type*: integer - An integer identifier for the member in the replica set, unique - among all members. - - Starting in MongoDB 5.0, values may be any integer value greater - than or equal to ``0``. Previously, this value was limited to an - integer between ``0`` and ``255`` inclusive. - - Each replica set member must have a unique - :rsconf:`_id `. Avoid re-using ``_id`` values - *even if* no :rsconf:`members[n]` entry is using that ``_id`` in - the current configuration. + An integer identifier of every member in the replica set. Values + must be between 0 and 255 inclusive. Each replica set member must + have a unique :rsconf:`_id `. Avoid re-using + ``_id`` values *even if* no :rsconf:`members[n]` entry is using + that ``_id`` in the current configuration. Once set, you cannot change the :rsconf:`_id ` of a member. diff --git a/source/reference/write-concern.txt b/source/reference/write-concern.txt index 2a0828e1d00..9c448d2afc4 100644 --- a/source/reference/write-concern.txt +++ b/source/reference/write-concern.txt @@ -390,6 +390,13 @@ For details, see :ref:`causal-consistency`. - Starting in MongoDB 4.4, replica set members in the :replstate:`STARTUP2` state do not participate in write majorities. +Write Concern not Supported on ``local`` Database +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The :ref:`local database ` does not support +write concerns. MongoDB silently ignores any configured write +concern for an operation on a collection in the local database. + .. _calculating-majority-count: Calculating Majority for Write Concern diff --git a/source/release-notes.txt b/source/release-notes.txt index f998053e4da..5391d649b6c 100644 --- a/source/release-notes.txt +++ b/source/release-notes.txt @@ -9,18 +9,6 @@ Always install the latest, stable version of MongoDB. See See the following release notes for an account of the changes in major versions. Release notes also include instructions for upgrade. -Upcoming Release -~~~~~~~~~~~~~~~~ - -(*5.0-series*) - -:doc:`/release-notes/5.0` - -.. toctree:: - :maxdepth: 1 - :hidden: - - /release-notes/5.0 Current Stable Release ~~~~~~~~~~~~~~~~~~~~~~ @@ -95,3 +83,4 @@ See also: :doc:`/reference/versioning` :hidden: /reference/versioning + diff --git a/source/release-notes/2.4-javascript.txt b/source/release-notes/2.4-javascript.txt index 6cc4ebcf5fd..335bae621e0 100644 --- a/source/release-notes/2.4-javascript.txt +++ b/source/release-notes/2.4-javascript.txt @@ -80,7 +80,7 @@ Removed Non-Standard SpiderMonkey Features ------------------------------------------ V8 does **not** support the following *non-standard* `SpiderMonkey -`_ JavaScript +`_ JavaScript extensions, previously supported by MongoDB's use of SpiderMonkey as its JavaScript engine. @@ -88,7 +88,7 @@ E4X Extensions ~~~~~~~~~~~~~~ V8 does not support the *non-standard* `E4X -`_ extensions. E4X +`_ extensions. E4X provides a native `XML `_ object to the JavaScript language and adds the syntax for embedding diff --git a/source/release-notes/3.2-javascript.txt b/source/release-notes/3.2-javascript.txt index 771c9be9479..bc471987221 100644 --- a/source/release-notes/3.2-javascript.txt +++ b/source/release-notes/3.2-javascript.txt @@ -12,7 +12,7 @@ JavaScript Changes in MongoDB 3.2 In MongoDB 3.2, the javascript engine used for both the :binary:`~bin.mongo` shell and for server-side javascript in :binary:`~bin.mongod` changed from V8 to -`SpiderMonkey `_. +`SpiderMonkey `_. To confirm which JavaScript engine you are using, you can use either :js:func:`interpreterVersion()` method in the :binary:`~bin.mongo` shell and the diff --git a/source/release-notes/3.4-downgrade-replica-set.txt b/source/release-notes/3.4-downgrade-replica-set.txt index f234a36c580..505be55506b 100644 --- a/source/release-notes/3.4-downgrade-replica-set.txt +++ b/source/release-notes/3.4-downgrade-replica-set.txt @@ -93,8 +93,9 @@ reindex operation does not propagate to the secondaries. .. tip:: - If connecting a :binary:`~bin.mongo` shell to a secondary member, - use :method:`rs.secondaryOk()` to allow reads from secondaries. + If connecting a :binary:`~bin.mongo` shell to a secondary member, use + :method:`db.getMongo().setReadPref('secondary')` to allow reads from + secondaries. Procedure --------- diff --git a/source/release-notes/3.4-downgrade-sharded-cluster.txt b/source/release-notes/3.4-downgrade-sharded-cluster.txt index a97e4fb5664..1d2bcb1f179 100644 --- a/source/release-notes/3.4-downgrade-sharded-cluster.txt +++ b/source/release-notes/3.4-downgrade-sharded-cluster.txt @@ -97,8 +97,8 @@ servers: .. tip:: If connecting a :binary:`~bin.mongo` shell to a secondary member, - use :method:`rs.secondaryOk()` to allow reads from - secondaries. + use :method:`db.getMongo().setReadPref('secondary')` to allow + reads from secondaries. #. Repeat the process on each member of the config server replica set. diff --git a/source/release-notes/3.6.txt b/source/release-notes/3.6.txt index af45ce2500d..054d7561898 100644 --- a/source/release-notes/3.6.txt +++ b/source/release-notes/3.6.txt @@ -13,8 +13,8 @@ Release Notes for MongoDB 3.6 Minor Releases -------------- -3.6.21 - Upcoming -~~~~~~~~~~~~~~~~~ +3.6.21 - Nov 16, 2020 +~~~~~~~~~~~~~~~~~~~~~ Issues Fixed: @@ -24,8 +24,6 @@ Issues Fixed: database lock - :issue:`SERVER-49986`: Convert isMaster command to hello and add aliases -- :issue:`SERVER-50291`: Add query knob to enumerate $or children in a - different order - :issue:`SERVER-50736`: Make OpenSSL explicitly accept SNIs presented in ClientHello - :issue:`SERVER-51120`: Find queries with MERGE_SORT incorrectly sort diff --git a/source/release-notes/4.0-changelog.txt b/source/release-notes/4.0-changelog.txt index d9e9f44c4e4..b09cdb99427 100644 --- a/source/release-notes/4.0-changelog.txt +++ b/source/release-notes/4.0-changelog.txt @@ -10,6 +10,8 @@ :depth: 1 :class: twocols +.. include:: /includes/changelogs/releases/4.0.22.rst + .. include:: /includes/changelogs/releases/4.0.21.rst .. include:: /includes/changelogs/releases/4.0.20.rst diff --git a/source/release-notes/4.0.txt b/source/release-notes/4.0.txt index 0e2ff2f5ef6..05c565b6961 100644 --- a/source/release-notes/4.0.txt +++ b/source/release-notes/4.0.txt @@ -13,10 +13,33 @@ Release Notes for MongoDB 4.0 Minor Releases -------------- +.. _4.0.22-release-notes: + +4.0.22 - Jan 4, 2021 +~~~~~~~~~~~~~~~~~~~~ + +Issues fixed: + +- :issue:`SERVER-48523` Unconditionally check the first entry in the + oplog when attempting to resume a change stream +- :issue:`SERVER-50365` Stuck with long-running transactions that can't + be timed out +- :issue:`SERVER-51303` Lookup stage followed by $match on type uses + wrong field in matching condition +- :issue:`SERVER-52654` new signing keys not generated by the + monitoring-keys-for-HMAC thread +- :issue:`SERVER-52955` KeysCollectionClientDirect should check if + majority read concern is supported by storage engine + +- `All JIRA issues closed in 4.0.22 + `_ + +- :ref:`4.0.22-changelog` + .. _4.0.21-release-notes: -4.0.21 - Upcoming -~~~~~~~~~~~~~~~~~ +4.0.21 - Nov 10, 2020 +~~~~~~~~~~~~~~~~~~~~~ Issues fixed: @@ -37,7 +60,7 @@ Issues fixed: self-ownership - :issue:`SERVER-50915` [v4.0] fsyncLock must not take a stable checkpoint when majority read concern is off -- :issue:`SERVER-51120` Find queries with MERGE_SORT incorrectly sort +- :issue:`SERVER-51120` Find queries with SORT_MERGE incorrectly sort the results when the collation is specified - `All JIRA issues closed in 4.0.21 diff --git a/source/release-notes/4.2-changelog.txt b/source/release-notes/4.2-changelog.txt index 91a8e423151..0de491fea59 100644 --- a/source/release-notes/4.2-changelog.txt +++ b/source/release-notes/4.2-changelog.txt @@ -10,6 +10,10 @@ :depth: 1 :class: singlecol +.. include:: /includes/changelogs/releases/4.2.12.rst + +.. include:: /includes/changelogs/releases/4.2.11.rst + .. include:: /includes/changelogs/releases/4.2.10.rst .. include:: /includes/changelogs/releases/4.2.9.rst diff --git a/source/release-notes/4.2-downgrade-replica-set.txt b/source/release-notes/4.2-downgrade-replica-set.txt index d73351b882c..a28bbd89caf 100644 --- a/source/release-notes/4.2-downgrade-replica-set.txt +++ b/source/release-notes/4.2-downgrade-replica-set.txt @@ -137,7 +137,14 @@ Remove all persisted 4.2 features that are :ref:`incompatible with 4.0 Script .. include:: /includes/extracts/4.2-downgrade-fcv-unique-index-script.rst -2d. Remove Wildcard Indexes +2d. Remove ``user_1_db_1`` System Unique Index +`````````````````````````````````````````````` + +.. container:: + + .. include:: /includes/extracts/4.2-downgrade-fcv-system-unique-index.rst + +2e. Remove Wildcard Indexes ```````````````````````````` .. container:: @@ -145,7 +152,7 @@ Remove all persisted 4.2 features that are :ref:`incompatible with 4.0 .. include:: /includes/extracts/4.2-downgrade-fcv-wildcard-index.rst -2e. View Definitions/Collection Validation Definitions that Include 4.2 Operators +2f. View Definitions/Collection Validation Definitions that Include 4.2 Operators ````````````````````````````````````````````````````````````````````````````````` .. container:: diff --git a/source/release-notes/4.2-downgrade-sharded-cluster.txt b/source/release-notes/4.2-downgrade-sharded-cluster.txt index abaf6d5e56d..ad80b17abf5 100644 --- a/source/release-notes/4.2-downgrade-sharded-cluster.txt +++ b/source/release-notes/4.2-downgrade-sharded-cluster.txt @@ -130,14 +130,21 @@ Remove all persisted 4.2 features that are :ref:`incompatible with 4.0 Script to run on shards .. include:: /includes/extracts/4.2-downgrade-fcv-unique-index-script-local-users.rst -2d. Remove Wildcard Indexes +2d. Remove ``user_1_db_1`` System Unique Index +`````````````````````````````````````````````` + +.. container:: + + .. include:: /includes/extracts/4.2-downgrade-fcv-system-unique-index.rst + +2e. Remove Wildcard Indexes ``````````````````````````` .. container:: .. include:: /includes/extracts/4.2-downgrade-fcv-wildcard-index.rst -2e. View Definitions/Collection Validation Definitions that Include 4.2 Operators +2f. View Definitions/Collection Validation Definitions that Include 4.2 Operators ````````````````````````````````````````````````````````````````````````````````` .. container:: diff --git a/source/release-notes/4.2-downgrade-standalone.txt b/source/release-notes/4.2-downgrade-standalone.txt index 5b4abed116f..068ad2b453d 100644 --- a/source/release-notes/4.2-downgrade-standalone.txt +++ b/source/release-notes/4.2-downgrade-standalone.txt @@ -100,14 +100,21 @@ Remove all persisted 4.2 features that are :ref:`incompatible with 4.0 Script .. include:: /includes/extracts/4.2-downgrade-fcv-unique-index-script.rst -2d. Remove Wildcard Indexes +2d. Remove ``user_1_db_1`` System Unique Index +`````````````````````````````````````````````` + +.. container:: + + .. include:: /includes/extracts/4.2-downgrade-fcv-system-unique-index.rst + +2e. Remove Wildcard Indexes ``````````````````````````` .. container:: .. include:: /includes/extracts/4.2-downgrade-fcv-wildcard-index.rst -2e. View Definitions/Collection Validation Definitions that Include 4.2 Operators +2f. View Definitions/Collection Validation Definitions that Include 4.2 Operators ````````````````````````````````````````````````````````````````````````````````` .. container:: diff --git a/source/release-notes/4.2.txt b/source/release-notes/4.2.txt index 8e0b763c75f..c87f8f41d81 100644 --- a/source/release-notes/4.2.txt +++ b/source/release-notes/4.2.txt @@ -17,6 +17,54 @@ Release Notes for MongoDB 4.2 Minor Releases -------------- +.. _4.2.12-release-notes: + +4.2.12 - Upcoming +~~~~~~~~~~~~~~~~~ + +Issues fixed in 4.2.12: + + +- :issue:`SERVER-40361`: Reduce memory footprint of plan cache entries + +- :issue:`SERVER-47863`: Initial Sync Progress Metrics + +- :issue:`SERVER-48471`: Hashed indexes may be incorrectly marked multikey and be ineligible as a shard key + +- :issue:`SERVER-50769`: server restarted after expr{"expr":"_currentApplyOps.getArrayLength() > 0","file":"src/mongo/db/pipeline/document_source_change_stream_transform.cpp","line":535}} + +- :issue:`SERVER-52654`: new signing keys not generated by the monitoring-keys-for-HMAC thread + +- :issue:`SERVER-52879`: Periodic operation latency spikes every 5 minutes due to closing idle cached WT sessions + +- `All JIRA issues closed in 4.2.12 + `__ + +- :ref:`4.2.12-changelog` + +.. _4.2.11-release-notes: + +4.2.11 - Nov 18, 2020 +~~~~~~~~~~~~~~~~~~~~~ + +Issues fixed in 4.2.11: + + +- :issue:`SERVER-43664`: Speedup WiredTiger storage engine startup for many tables by optimizing WiredTigerUtil::setTableLogging() + +- :issue:`SERVER-45938`: Allow matching O/OU/DC in client x509 cert if clusterMode:keyFile + +- :issue:`SERVER-48523`: Unconditionally check the first entry in the oplog when attempting to resume a change stream + +- :issue:`SERVER-51120`: Find queries with SORT_MERGE incorrectly sort the results when the collation is specified + +- :issue:`WT-6507`: Exit cache eviction worker after our operation has timed out + +- `All JIRA issues closed in 4.2.11 + `__ + +- :ref:`4.2.11-changelog` + .. _4.2.10-release-notes: 4.2.10 - Oct 2, 2020 diff --git a/source/release-notes/4.4-changelog.txt b/source/release-notes/4.4-changelog.txt index c6d49bac275..480d592007e 100644 --- a/source/release-notes/4.4-changelog.txt +++ b/source/release-notes/4.4-changelog.txt @@ -10,6 +10,8 @@ :depth: 1 :class: singlecol +.. include:: /includes/changelogs/releases/4.4.3.rst + .. include:: /includes/changelogs/releases/4.4.2.rst .. include:: /includes/changelogs/releases/4.4.1.rst diff --git a/source/release-notes/4.4-compatibility.txt b/source/release-notes/4.4-compatibility.txt index 567a2ca23d9..2dc58418d54 100644 --- a/source/release-notes/4.4-compatibility.txt +++ b/source/release-notes/4.4-compatibility.txt @@ -182,6 +182,24 @@ Text Search Metadata { $meta: "textScore" } Query Requirement .. include:: /includes/extracts/4.4-changes-textscore-predicate.rst +``$sort`` Stability Changes +--------------------------- + +Starting in MongoDB 4.4, the :method:`~cursor.sort()` method now uses +the same sort algorithm as the :pipeline:`$sort` aggregation stage. With +this change, queries which perform a :method:`~cursor.sort()` on +fields that contain duplicate values are much more likely to result in +inconsistent sort orders for those values. + +To guarantee sort stability when using :method:`~cursor.sort()` on +duplicate values, include an additional field in your sort that contains +exclusively unique values. + +This can be accomplished easily by adding the ``_id`` field to your +sort. + +See :ref:`sort-cursor-stable-sorting` for more information. + Map Reduce Changes ------------------ diff --git a/source/release-notes/4.4.txt b/source/release-notes/4.4.txt index c752c39ed33..b896169b97e 100644 --- a/source/release-notes/4.4.txt +++ b/source/release-notes/4.4.txt @@ -13,10 +13,30 @@ Release Notes for MongoDB 4.4 Minor Releases -------------- +.. _4.4.3-release-notes: + +4.4.3 - Jan 4, 2021 +~~~~~~~~~~~~~~~~~~~ + +Issues fixed: + +- :issue:`SERVER-33966`: redundant $sort in aggregation prevents best + $limit $sort consolidation +- :issue:`SERVER-40361`: Reduce memory footprint of plan cache entries +- :issue:`SERVER-52654`: new signing keys not generated by the + monitoring-keys-for-HMAC thread +- :issue:`SERVER-52824`: Support AWS roles with paths +- :issue:`SERVER-52929`: Correctly handle compound indexes with 32 keys + +- `All JIRA issues closed in 4.4.3 + `_ + +- :ref:`4.4.3-changelog` + .. _4.4.2-release-notes: -4.4.2 - Upcoming -~~~~~~~~~~~~~~~~ +4.4.2 - Nov 18, 2020 +~~~~~~~~~~~~~~~~~~~~ Issues fixed: @@ -975,6 +995,27 @@ Transactions - :doc:`/core/transactions` - :ref:`transactions-operations-ref` +Sorting +------- + +``$sort`` Stability Changes +~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Starting in MongoDB 4.4, the :method:`~cursor.sort()` method now uses +the same sort algorithm as the :pipeline:`$sort` aggregation stage. With +this change, queries which perform a :method:`~cursor.sort()` on +fields that contain duplicate values are much more likely to result in +inconsistent sort orders for those values. + +To guarantee sort stability when using :method:`~cursor.sort()` on +duplicate values, include an additional field in your sort that contains +exclusively unique values. + +This can be accomplished easily by adding the ``_id`` field to your +sort. + +See :ref:`sort-cursor-stable-sorting` for more information. + Security Improvements --------------------- @@ -2186,7 +2227,7 @@ Known Issues reads or :ref:`hedged reads ` may not be routed to a near shard replica. - - Unresolved + - Fixed in 4.4.1 * - 4.4.0 diff --git a/source/release-notes/5.0-changelog.txt b/source/release-notes/5.0-changelog.txt deleted file mode 100644 index 2ee5de1185c..00000000000 --- a/source/release-notes/5.0-changelog.txt +++ /dev/null @@ -1,11 +0,0 @@ -============= -5.0 Changelog -============= - -.. default-domain:: mongodb - -.. contents:: On this page - :local: - :backlinks: none - :depth: 1 - :class: singlecol diff --git a/source/release-notes/5.0-compatibility.txt b/source/release-notes/5.0-compatibility.txt deleted file mode 100644 index 8130ecf2447..00000000000 --- a/source/release-notes/5.0-compatibility.txt +++ /dev/null @@ -1,39 +0,0 @@ -==================================== -Compatibility Changes in MongoDB 5.0 -==================================== - -.. default-domain:: mongodb - -.. contents:: On this page - :local: - :backlinks: none - :depth: 1 - :class: singlecol - -The following 5.0 changes can affect compatibility with older -versions of MongoDB. - - -Removed Commands ----------------- - -Removed Parameters ------------------- - -Tools Changes -------------- - -Replica Sets ------------- - -Projection Compatibility Changes --------------------------------- - -Map Reduce Changes ------------------- - -General Changes ---------------- - -5.0 Feature Compatibility -------------------------- diff --git a/source/release-notes/5.0.txt b/source/release-notes/5.0.txt deleted file mode 100644 index 9d5dd8b9128..00000000000 --- a/source/release-notes/5.0.txt +++ /dev/null @@ -1,176 +0,0 @@ -============================= -Release Notes for MongoDB 5.0 -============================= - -.. default-domain:: mongodb - -.. contents:: On this page - :local: - :backlinks: none - :depth: 1 - :class: twocols - -.. _5.0-rel-notes-agg: - -Aggregation ------------ - -General Aggregation Improvements -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -``let`` -``````` - -Starting in MongoDB 5.0, the :dbcommand:`aggregate` command and -:method:`db.collection.aggregate()` helper method have a ``let`` option -to specify a list of constants that can be used elsewhere in the -aggregation pipeline. This supports tasks that could otherwise only be -performed using the :dbcommand:`mapReduce` command, and reduces the risk -of MQL injection attacks. - - -.. _5.0-rel-notes-repl-sets: - -Replica Sets ------------- - -Limit Removed for ``members[n]._id`` Values -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Starting in MongoDB 5.0, the :rsconf:`members[n]._id` field may be any -integer value greater than or equal to ``0``. Previously, this value was -limited to an integer between ``0`` and ``255`` inclusive. - -.. _5.0-rel-notes-sharded-clusters: - -Sharded Clusters ----------------- - -.. _5.0-rel-notes-projection: - -Projection ----------- - -.. _5.0-rel-notes-transactions: - -Transactions ------------- - -.. _5.0-rel-notes-security: - -Security Improvements ---------------------- - -.. _5.0-rel-notes-logging: - -Structured Logging ------------------- - -.. _5.0-rel-notes-platforms: - -Platform Support ----------------- - -.. _5.0-rel-notes-shell: - -Mongo Shell ------------ - -.. _5.0-rel-notes-drivers: - -Drivers -------- - -.. _5.0-rel-notes-indexes: - -Indexes -------- - -.. _5.0-rel-notes-removed-commands: - -Removed Commands ----------------- - -.. _5.0-rel-notes-networking: - -Networking ----------- - -.. _5.0-rel-notes-general: - -General Improvements --------------------- - -.. _5.0-upgrade: - -``serverStatus`` Output Change -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -New Fields -`````````` - -:dbcommand:`serverStatus` includes the following new fields in its -output: - -.. container:: - - Aggregation Metrics - .. list-table:: - - * - | :serverstatus:`metrics.commands.update.pipeline` *(Also available in 4.4.2+, 4.2.11+)* - | :serverstatus:`metrics.commands.update.arrayFilters` *(Also available in 4.4.2+, 4.2.11+)* - | :serverstatus:`metrics.commands.findAndModify.pipeline` *(Also available in 4.4.2+, 4.2.11+)* - | :serverstatus:`metrics.commands.findAndModify.arrayFilters` *(Also available in 4.4.2+, 4.2.11+)* - -Additional ``dbStats`` Free Space Statistics -~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - -Starting in MongoDB 5.0, the :dbcommand:`dbStats` command outputs these -additional statistics: - -- Free space allocated to collections (:data:`~dbStats.freeStorageSize`) - -- Free space allocated to indexes - (:data:`~dbStats.indexFreeStorageSize`) - -- Total free space allocated to collections and indexes - (:data:`~dbStats.totalFreeStorageSize`) - -Upgrade Procedures ------------------- - -.. _5.0-download: - -Download --------- - -To download MongoDB 5.0, go to the `MongoDB Download Center -`_. - -.. seealso:: - - - `All Third Party License Notices `_. - -.. _5.0-known-issues: - -Known Issues ------------- - -Report an Issue ---------------- - -To report an issue, see -https://github.com/mongodb/mongo/wiki/Submit-Bug-Reports for -instructions on how to file a JIRA ticket for the MongoDB server or one -of the related projects. - -.. class:: hidden - - .. toctree:: - - /release-notes/5.0-compatibility - /release-notes/4.4-upgrade-standalone - /release-notes/4.4-upgrade-replica-set - /release-notes/4.4-upgrade-sharded-cluster - /release-notes/4.4-downgrade - /release-notes/5.0-changelog diff --git a/source/tutorial.txt b/source/tutorial.txt index 2a66a3414be..228e8603257 100644 --- a/source/tutorial.txt +++ b/source/tutorial.txt @@ -9,7 +9,7 @@ MongoDB Tutorials ================= This page lists the tutorials available as part of the :doc:`MongoDB -Manual `. In addition to these tutorial in the manual, +Manual `. In addition to these tutorials in the manual, MongoDB provides :ref:`Getting Started Guides ` in various driver editions. If there is a process or pattern that you would like to see included here, please open a :issue:`Jira Case diff --git a/source/tutorial/change-oplog-size.txt b/source/tutorial/change-oplog-size.txt index 3eaf32db930..dd3f0400e15 100644 --- a/source/tutorial/change-oplog-size.txt +++ b/source/tutorial/change-oplog-size.txt @@ -119,7 +119,13 @@ The following operation runs the ``compact`` command against the .. code-block:: javascript use local - db.runCommand({ "compact" : "oplog.rs" } ) + db.runCommand({ "compact" : "oplog.rs" }) + +If the disk space allocated to the original oplog size is not +reclaimed, restart :binary:`~bin.mongod` and run the commands from step +D again. Restarting :binary:`~bin.mongod` runs recalculations in +:doc:`WiredTiger ` that might allow ``compact`` to +release more space to the OS. For clusters enforcing :ref:`authentication `, authenticate as a user with the :authaction:`compact` privilege diff --git a/source/tutorial/configure-ssl.txt b/source/tutorial/configure-ssl.txt index 1fad6fe9617..5651441efb0 100644 --- a/source/tutorial/configure-ssl.txt +++ b/source/tutorial/configure-ssl.txt @@ -49,8 +49,9 @@ Certificate Authorities When establishing a TLS/SSL connection, the :binary:`~bin.mongod`/:binary:`~bin.mongos` presents a certificate key -file (containing a public key certificate and its associated private -key) to its clients to establish its identity. [#FIPS]_ +file to its clients to establish its identity. [#FIPS]_ The certificate +key file contains a public key certificate and its associated private +key, but only the public component is revealed to the client. MongoDB can use any valid TLS/SSL certificate issued by a certificate authority, or a self-signed certificate. If you use a self-signed diff --git a/source/tutorial/install-mongodb-enterprise-on-windows-unattended.txt b/source/tutorial/install-mongodb-enterprise-on-windows-unattended.txt index 8576150e25a..a8387fa29bf 100644 --- a/source/tutorial/install-mongodb-enterprise-on-windows-unattended.txt +++ b/source/tutorial/install-mongodb-enterprise-on-windows-unattended.txt @@ -38,12 +38,10 @@ MongoDB Version Installation Method ~~~~~~~~~~~~~~~~~~~ -This tutorial installs MongoDB on Windows in an unattended fashion using -``msiexec.exe``. Alternatively, you may chose to install MongoDB on -Windows using the default installation wizard. - -|arrow| See :doc:`/tutorial/install-mongodb-enterprise-on-windows` for -instructions. +This tutorial installs MongoDB on Windows using the command-line tool +``msiexec.exe``. To install MongoDB using the graphical MSI Installer +instead, see :doc:`Install MongoDB using the MSI Installer +`. Considerations -------------- diff --git a/source/tutorial/install-mongodb-enterprise-on-windows.txt b/source/tutorial/install-mongodb-enterprise-on-windows.txt index eca5a2b0178..258e1a2f6e5 100644 --- a/source/tutorial/install-mongodb-enterprise-on-windows.txt +++ b/source/tutorial/install-mongodb-enterprise-on-windows.txt @@ -37,14 +37,12 @@ MongoDB Version Installation Method ~~~~~~~~~~~~~~~~~~~ -This tutorial installs MongoDB on Windows using the default installation -wizard. Alternatively, you may chose to install MongoDB on Windows in an -unattended fashion, using ``msiexec.exe`` from the command line -(``cmd.exe``). This is useful for system administrators who wish to -deploy MongoDB using automation. - -|arrow| See :doc:`/tutorial/install-mongodb-enterprise-on-windows-unattended` -for instructions. +This tutorial installs MongoDB on Windows using the default MSI +installation wizard. To install MongoDB using the ``msiexec.exe`` +command-line tool instead, see :doc:`Install MongoDB using msiexec.exe +`. The +``msiexec.exe`` tool is useful for system administrators who wish to +deploy MongoDB in an unattended fashion using automation. Considerations -------------- diff --git a/source/tutorial/install-mongodb-on-os-x.txt b/source/tutorial/install-mongodb-on-os-x.txt index 10827d57043..4e6a9510d8c 100644 --- a/source/tutorial/install-mongodb-on-os-x.txt +++ b/source/tutorial/install-mongodb-on-os-x.txt @@ -24,7 +24,13 @@ Overview .. _`MongoDB Download Center`: https://www.mongodb.com/try/download/community?tck=docs_server Use this tutorial to install MongoDB {+version+} |edition| Edition on -macOS using the third-party |package-manager| package manager. +macOS using the third-party `Homebrew `__ +package manager. + +Starting with MongoDB 4.4.1, installing MongoDB via Homebrew also +installs the `MongoDB Database Tools +`__. See +:ref:`brew-installs-dbtools` for more information. MongoDB Version ~~~~~~~~~~~~~~~ @@ -54,72 +60,102 @@ Install MongoDB Community Edition Prerequisites ~~~~~~~~~~~~~ -If you have the Homebrew ``brew`` package installed on your OSX host -*and* you have previously tapped the official -`MongoDB Homebrew Tap `_, -skip the prerequisites and go to the :ref:`install` step. +Ensure your system meets each of the following prerequisites. You only +need to perform each prerequisite step once on your system. If you +have already performed the prerequisite steps as part of an earlier +MongoDB installation using Homebrew, you can skip to the +:ref:`installation procedure `. + +Install Xcode Command-Line Tools +```````````````````````````````` + +Homebrew requires the Xcode command-line tools from Apple's Xcode. + +- Install the Xcode command-line tools by running the following + command in your macOS Terminal: -Install XCode -````````````` -.. container:: + .. code-block:: sh - Apple's XCode includes command-line tools that are required - by ``brew``, and is available for free on the App Store. Make sure - you are running the latest version. + xcode-select --install Install Homebrew ```````````````` -.. container:: +macOS does not include the Homebrew ``brew`` package by default. - OSX does not include the Homebrew ``brew`` package by default. - Install ``brew`` using the - `official instructions `_. +- Install ``brew`` using the official + `Homebrew installation instructions `_. Tap the MongoDB Homebrew Tap ```````````````````````````` -.. container:: +Tap the +`MongoDB Homebrew Tap `_ to +download the official Homebrew formulae for MongoDB and the Database +Tools. - Issue the following from the terminal to - tap the official - `MongoDB Homebrew Tap `_: +- Run the following command in your macOS Terminal: - .. code-block:: sh + .. code-block:: sh - brew tap mongodb/brew + brew tap mongodb/brew .. _install: -Procedure -~~~~~~~~~ +Installing MongoDB {+version+} |edition| Edition +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +Follow these steps to install MongoDB |edition| Edition using Homebrew's +``brew`` package manager. + +#. Verify that your system meets all the + :ref:`installation prerequisites ` by running the + following command in your macOS Terminal: + + .. code-block:: sh -Follow these steps to install MongoDB |edition| Edition using the -third-party ``brew`` package manager. + brew tap | grep mongodb -.. container:: + You should see the MongoDB brew tap listed. If you do not, or you + receive an error, return to the :ref:`osx-prereq` section. - From a terminal, issue the following: +#. To install MongoDB, run the following command in your macOS Terminal + application: .. code-block:: sh brew install mongodb-community@{+version+} - .. tip:: - - If you have previously installed an older version of the formula, - you may encounter a ChecksumMismatchError. To resolve, see - :ref:`troubleshooting-checksumerror`. + Alternatively, you can specify a previous version of MongoDB if + desired. You can also maintain multiple versions of MongoDB side by + side in this manner. + +.. tip:: + + If you have previously installed an older version of the formula, + you may encounter a ChecksumMismatchError. To resolve, see + :ref:`troubleshooting-checksumerror`. + +The installation includes the following binaries: - In addition to the :doc:`binaries `, the install - creates: +- The :binary:`~bin.mongod` server +- The :binary:`~bin.mongos` sharded cluster query router +- The :binary:`~bin.mongo` shell - - the :doc:`configuration file ` - (:file:`/usr/local/etc/mongod.conf`) +In addition, the installation creates: - - the :setting:`log directory path ` (``/usr/local/var/log/mongodb``) +- the :doc:`configuration file ` + (``/usr/local/etc/mongod.conf``) - - the :setting:`data directory path ` (``/usr/local/var/mongodb``) +- the :setting:`log directory path ` + (``/usr/local/var/log/mongodb``) + +- the :setting:`data directory path ` + (``/usr/local/var/mongodb``) + +Starting with MongoDB 4.4.1, the installation also includes the +`MongoDB Database Tools `__. +See :ref:`brew-installs-dbtools` for more information. .. _run-with-homebrew: @@ -129,100 +165,140 @@ Run MongoDB Community Edition Follow these steps to run MongoDB |edition| Edition. These instructions assume that you are using the default settings. -.. container:: +You can run MongoDB as a macOS service using ``brew``, or you can run +MongoDB manually as a background process. It is recommended to run +MongoDB as a macOS service, as doing so sets the correct system +``ulimit`` values automatically (see +:ref:`ulimit settings ` for more information). - You can run MongoDB as a macOS service using ``brew``, or you can run - MongoDB manually as a background process. It is recommended to run - MongoDB as a macOS service, as doing so sets the correct system - ``ulimit`` values automatically (see - :ref:`ulimit settings ` for more information). +- To run MongoDB (i.e. the :binary:`~bin.mongod` process) **as a + macOS service**, issue the following: - - To run MongoDB (i.e. the :binary:`~bin.mongod` process) **as a - macOS service**, issue the following: + .. code-block:: sh - .. code-block:: sh + brew services start mongodb-community@{+version+} - brew services start mongodb-community@{+version+} + To stop a :binary:`~bin.mongod` running as a macOS service, use the + following command as needed: - To stop a :binary:`~bin.mongod` running as a macOS service, use the - following command as needed: + .. code-block:: sh - .. code-block:: sh + brew services stop mongodb-community@{+version+} - brew services stop mongodb-community@{+version+} +- To run MongoDB (i.e. the :binary:`~bin.mongod` process) **manually + as a background process**, issue the following: - - To run MongoDB (i.e. the :binary:`~bin.mongod` process) **manually - as a background process**, issue the following: + .. code-block:: sh - .. code-block:: sh + mongod --config /usr/local/etc/mongod.conf --fork - mongod --config /usr/local/etc/mongod.conf --fork + To stop a :binary:`~bin.mongod` running as a background process, + connect to the :binary:`~bin.mongod` from the :program:`mongo` + shell, and issue the :dbcommand:`shutdown` command as needed. - To stop a :binary:`~bin.mongod` running as a background process, - connect to the :binary:`~bin.mongod` from the :program:`mongo` - shell, and issue the :dbcommand:`shutdown` command as needed. +Both methods use the :file:`/usr/local/etc/mongod.conf` file created +during the install. You can add your own MongoDB +:doc:`configuration options ` to +this file as well. - Both methods use the :file:`/usr/local/etc/mongod.conf` file created - during the install. You can add your own MongoDB - :doc:`configuration options ` to - this file as well. +.. admonition:: macOS Prevents ``mongod`` From Opening + :class: note - .. admonition:: macOS Prevents ``mongod`` From Opening - :class: note + macOS may prevent ``mongod`` from running after installation. If + you receive a security error when starting ``mongod`` + indicating that the developer could not be identified or verified, + do the following to grant ``mongod`` access to run: - macOS may prevent ``mongod`` from running after installation. If - you receive a security error when starting ``mongod`` - indicating that the developer could not be identified or verified, - do the following to grant ``mongod`` access to run: + - Open *System Preferences* + - Select the *Security and Privacy* pane. + - Under the *General* tab, click the button to the right of the + message about ``mongod``, labelled either :guilabel:`Open Anyway` + or :guilabel:`Allow Anyway` depending on your version of macOS. - - Open *System Preferences* - - Select the *Security and Privacy* pane. - - Under the *General* tab, click the button to the right of the - message about ``mongod``, labelled either :guilabel:`Open Anyway` - or :guilabel:`Allow Anyway` depending on your version of macOS. +To verify that MongoDB is running, perform one of the following: - To verify that MongoDB is running, search for ``mongod`` in your - running processes: +- If you started MongoDB **as a macOS service**: - .. code-block:: sh + .. code-block:: sh + + brew services list - ps aux | grep -v grep | grep mongod + You should see the service ``mongodb-community`` listed as + ``started``. - You can also view the log file to see the current status of your - ``mongod`` process: ``/usr/local/var/log/mongodb/mongo.log``. +- If you started MongoDB **manually as a background process**: + + .. code-block:: sh + + ps aux | grep -v grep | grep mongod + + You should see your ``mongod`` process in the output. + +You can also view the log file to see the current status of your +``mongod`` process: ``/usr/local/var/log/mongodb/mongo.log``. Connect and Use MongoDB ~~~~~~~~~~~~~~~~~~~~~~~ -.. container:: +To begin using MongoDB, connect a :binary:`~bin.mongo` shell to the +running instance. From a new terminal, issue the following: - To begin using MongoDB, connect a :binary:`~bin.mongo` shell to the - running instance. From a new terminal, issue the following: +.. code-block:: sh - .. code-block:: sh + mongo + +.. admonition:: macOS Prevents ``mongo`` From Opening + :class: note + + macOS may prevent ``mongo`` from running after installation. If + you receive a security error when starting ``mongo`` + indicating that the developer could not be identified or verified, + do the following to grant ``mongo`` access to run: - mongo + - Open *System Preferences* + - Select the *Security and Privacy* pane. + - Under the *General* tab, click the button to the right of the + message about ``mongo``, labelled either :guilabel:`Open Anyway` + or :guilabel:`Allow Anyway` depending on your version of macOS. - .. admonition:: macOS Prevents ``mongo`` From Opening - :class: note +For information on CRUD (Create,Read,Update,Delete) operations, see: - macOS may prevent ``mongo`` from running after installation. If - you receive a security error when starting ``mongo`` - indicating that the developer could not be identified or verified, - do the following to grant ``mongo`` access to run: +- :doc:`/tutorial/insert-documents` +- :doc:`/tutorial/query-documents` +- :doc:`/tutorial/update-documents` +- :doc:`/tutorial/remove-documents` + +.. _brew-installs-dbtools: + +Using the MongoDB Database Tools +-------------------------------- + +Starting in MongoDB 4.4.1, installing MongoDB via ``brew`` also installs +the MongoDB Database Tools. + +The `MongoDB Database Tools +`__ are a collection of +command-line utilities for working with a MongoDB deployment, +including data backup and import/export tools like +:binary:`mongoimport` and :binary:`mongodump` as well as monitoring +tools like :binary:`mongotop`. + +Once you have installed the MongoDB Server in the steps above, the +Database Tools are available directly from the command line in your +macOS Terminal application. For example you could run :binary:`mongotop` +against your running MongoDB instance by invoking it in your +macOS Terminal like so: + +.. code-block:: sh - - Open *System Preferences* - - Select the *Security and Privacy* pane. - - Under the *General* tab, click the button to the right of the - message about ``mongo``, labelled either :guilabel:`Open Anyway` - or :guilabel:`Allow Anyway` depending on your version of macOS. + mongotop - For information on CRUD (Create,Read,Update,Delete) operations, see: +It should start up, connect to your running :binary:`mongod`, and start +reporting usage statistics. - - :doc:`/tutorial/insert-documents` - - :doc:`/tutorial/query-documents` - - :doc:`/tutorial/update-documents` - - :doc:`/tutorial/remove-documents` +See the `MongoDB Database Tools Documentation +`__ for usage information for +each of the Database Tools. Additional Information ---------------------- @@ -238,9 +314,10 @@ Troubleshooting ChecksumMismatchError ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ If you have previously installed an older version of the formula, -you may encounter a ChecksumMismatchError resembling the following: +you may encounter a ``ChecksumMismatchError`` resembling the following: .. code-block:: sh + :copyable: false Error: An exception occurred within a child process: diff --git a/source/tutorial/install-mongodb-on-windows-unattended.txt b/source/tutorial/install-mongodb-on-windows-unattended.txt index ee3c6fcf49e..08a63020199 100644 --- a/source/tutorial/install-mongodb-on-windows-unattended.txt +++ b/source/tutorial/install-mongodb-on-windows-unattended.txt @@ -34,12 +34,10 @@ MongoDB Version Installation Method ~~~~~~~~~~~~~~~~~~~ -This tutorial installs MongoDB on Windows in an unattended fashion using -``msiexec.exe``. Alternatively, you may chose to install MongoDB on -Windows using the default installation wizard. - -|arrow| See :doc:`/tutorial/install-mongodb-on-windows` for -instructions. +This tutorial installs MongoDB on Windows using the command-line tool +``msiexec.exe``. To install MongoDB using the graphical MSI Installer +instead, see :doc:`Install MongoDB using the MSI Installer +`. Considerations -------------- diff --git a/source/tutorial/install-mongodb-on-windows.txt b/source/tutorial/install-mongodb-on-windows.txt index 7804c47af58..eae45e72cef 100644 --- a/source/tutorial/install-mongodb-on-windows.txt +++ b/source/tutorial/install-mongodb-on-windows.txt @@ -32,14 +32,12 @@ MongoDB Version Installation Method ~~~~~~~~~~~~~~~~~~~ -This tutorial installs MongoDB on Windows using the default installation -wizard. Alternatively, you may chose to install MongoDB on Windows in an -unattended fashion, using ``msiexec.exe`` from the command line -(``cmd.exe``). This is useful for system administrators who wish to -deploy MongoDB using automation. - -|arrow| See :doc:`/tutorial/install-mongodb-on-windows-unattended` for -instructions. +This tutorial installs MongoDB on Windows using the default MSI +installation wizard. To install MongoDB using the ``msiexec.exe`` +command-line tool instead, see :doc:`Install MongoDB using msiexec.exe +`. The +``msiexec.exe`` tool is useful for system administrators who wish to +deploy MongoDB in an unattended fashion using automation. Considerations -------------- diff --git a/source/tutorial/manage-the-database-profiler.txt b/source/tutorial/manage-the-database-profiler.txt index e60062eab7e..401753ffa6b 100644 --- a/source/tutorial/manage-the-database-profiler.txt +++ b/source/tutorial/manage-the-database-profiler.txt @@ -86,6 +86,22 @@ The ``"ok" : 1`` key-value pair indicates the operation succeeded: To verify the new setting, see the :ref:`database-profiling-view-status` section. +Global and Per-Database Profiling Settings +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +The :ref:`slowms ` and +:ref:`sampleRate ` profiling +settings are *global*. When set, these settings affect all databases in +your process. + +When set via the :dbcommand:`profile` command or +:method:`db.setProfilingLevel()` shell helper method, :ref:`profiling +level ` and :ref:`filter +` settings are set at the *database* +level. When set as either command line or :ref:`configuration +file ` options, profiling level and ``filter`` +settings affect the entire process. + .. _database-profiling-specify-slowms-threshold: Specify the Threshold for Slow Operations @@ -196,6 +212,47 @@ sampling rate for logging slow operations: See :ref:`db-profiling-sharding`. +Set a Filter to Determine Profiled Operations +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. versionadded:: 4.4.2 + +You can set a filter to control which operations are profiled and +logged. You can set the profiling filter in one of the following ways: + +- Set the value of ``filter`` using the :dbcommand:`profile` command + or :method:`db.setProfilingLevel()` shell helper method. + +- Set the value of :setting:`~operationProfiling.filter` in a + :ref:`configuration file `. + +For :binary:`~bin.mongod` instances, the ``filter`` affects both the +diagnostic log and, if enabled, the profiler. + +For :binary:`~bin.mongos` instances, the ``filter`` affects the +diagnostic log only and not the profiler since profiling is not +available on :binary:`~bin.mongos`. + +.. note:: + + When a profiling ``filter`` is set, the :ref:`slowms + ` and :ref:`sampleRate + ` options do not affect the + diagnostic log or the profiler. + +For example, the following :method:`db.setProfilingLevel()` method sets +for a :binary:`~bin.mongod` instance: + +- the :ref:`profiling level ` to ``2``, + +- the :ref:`filter ` of + ``{ op: "query", millis: { $gt: 2000 } }``, which causes the profiler + to only log ``query`` operations that took longer than 2 seconds. + +.. code-block:: javascript + + db.setProfilingLevel( 2, { filter: { op: "query", millis: { $gt: 2000 } } } ) + .. _database-profiling-view-status: .. _database-profiling-check-level: @@ -287,6 +344,7 @@ However, starting in MongoDB 4.0, you can set the :option:`--slowms --slowOpSampleRate>` on :binary:`~bin.mongos` to configure the diagnostic log for slow operations. + View Profiler Data ------------------ @@ -303,7 +361,6 @@ output data, see :doc:`/reference/database-profiler`. You can use :query:`$comment` to add data to the query predicate to make it easier to analyze data from the profiler. - .. _database-profiling-example-queries: Example Profiler Data Queries diff --git a/source/tutorial/troubleshoot-replica-sets.txt b/source/tutorial/troubleshoot-replica-sets.txt index 0807d029207..9dd135112bd 100644 --- a/source/tutorial/troubleshoot-replica-sets.txt +++ b/source/tutorial/troubleshoot-replica-sets.txt @@ -291,74 +291,3 @@ tutorial. .. [#oplog] .. include:: /includes/fact-oplog-size.rst - -Oplog Entry Timestamp Error ---------------------------- - -.. todo:: link assertion 13290 here once assertion guide exists. - -Consider the following error in :binary:`~bin.mongod` output and logs: - -.. code-block:: javascript - - replSet error fatal couldn't query the local local.oplog.rs collection. Terminating mongod after 30 seconds. - [rsStart] bad replSet oplog entry? - -Often, an incorrectly typed value in the ``ts`` field in the last -:term:`oplog` entry causes this error. The correct data type is -Timestamp. - -Check the type of the ``ts`` value using the following two queries -against the oplog collection: - -.. code-block:: javascript - - db = db.getSiblingDB("local") - db.oplog.rs.find().sort({$natural:-1}).limit(1) - db.oplog.rs.find({ts:{$type:17}}).sort({$natural:-1}).limit(1) - -The first query returns the last document in the oplog, while the -second returns the last document in the oplog where the ``ts`` value -is a Timestamp. The :query:`$type` operator allows you to select -:term:`BSON type ` 17, is the Timestamp data type. - -If the queries don't return the same document, then the last document in -the oplog has the wrong data type in the ``ts`` field. - -.. example:: - - If the first query returns this as the last oplog entry: - - .. code-block:: javascript - - { "ts" : {t: 1347982456000, i: 1}, - "h" : NumberLong("8191276672478122996"), - "op" : "n", - "ns" : "", - "o" : { "msg" : "Reconfig set", "version" : 4 } } - - And the second query returns this as the last entry where ``ts`` - has the ``Timestamp`` type: - - .. code-block:: javascript - - { "ts" : Timestamp(1347982454000, 1), - "h" : NumberLong("6188469075153256465"), - "op" : "n", - "ns" : "", - "o" : { "msg" : "Reconfig set", "version" : 3 } } - - Then the value for the ``ts`` field in the last oplog entry is of the - wrong data type. - -To set the proper type for this value and resolve this issue, -use an update operation that resembles the following: - -.. code-block:: javascript - - db.oplog.rs.update( { ts: { t:1347982456000, i:1 } }, - { $set: { ts: new Timestamp(1347982456000, 1)}}) - -Modify the timestamp values as needed based on your oplog entry. This -operation may take some period to complete because the update must -scan and pull the entire oplog into memory.