From 0abd01ac8908b111e9e11814b9397f0b9a0d651f Mon Sep 17 00:00:00 2001 From: ian fogelman Date: Tue, 14 Sep 2021 12:00:11 -0400 Subject: [PATCH 1/3] DOCS-14281 add release notes and update partial index restrictions --- source/core/index-partial.txt | 8 +------- source/includes/fact-5.0-multiple-partial-index.rst | 10 ++++++++++ .../reference/method/db.collection.createIndexes.txt | 6 ++++-- source/release-notes/5.0.txt | 5 +++++ 4 files changed, 20 insertions(+), 9 deletions(-) create mode 100644 source/includes/fact-5.0-multiple-partial-index.rst diff --git a/source/core/index-partial.txt b/source/core/index-partial.txt index 5805f64981a..eb3c8346160 100644 --- a/source/core/index-partial.txt +++ b/source/core/index-partial.txt @@ -162,17 +162,11 @@ by the filter expression Restrictions ------------ -In MongoDB, you cannot create multiple versions of an index that -differ only in the options. As such, you cannot create multiple -partial indexes that differ only by the filter expression. +.. include:: /includes/fact-5.0-multiple-partial-index.rst You cannot specify both the ``partialFilterExpression`` option and the ``sparse`` option. -MongoDB 3.0 or earlier do not support partial indexes. To use partial -indexes, you must use MongoDB version 3.2 or higher. For sharded -clusters or replica sets, all nodes must be version 3.2 or higher. - ``_id`` indexes cannot be partial indexes. Shard key indexes cannot be partial indexes. diff --git a/source/includes/fact-5.0-multiple-partial-index.rst b/source/includes/fact-5.0-multiple-partial-index.rst new file mode 100644 index 00000000000..9f44b95f3ab --- /dev/null +++ b/source/includes/fact-5.0-multiple-partial-index.rst @@ -0,0 +1,10 @@ +Starting in MongoDB 5.0, multiple +:doc:`partial indexes ` +can be created using the same :ref:`key pattern` as long +as the :ref:`partialFilterExpression ` +fields do not express equivalent filters. + +In earlier versions of MongoDB, creating multiple +:doc:`partial indexes` is not allowed when +using the same key pattern with different +:ref:`partialFilterExpressions `. diff --git a/source/reference/method/db.collection.createIndexes.txt b/source/reference/method/db.collection.createIndexes.txt index 151f400f228..a9cfa6fa1fb 100644 --- a/source/reference/method/db.collection.createIndexes.txt +++ b/source/reference/method/db.collection.createIndexes.txt @@ -38,7 +38,8 @@ Definition - document - - An array containing index specification documents. Each document + - .. _key_patterns: + An array containing index specification documents. Each document contains field and value pairs where the field is the index key and the value describes the type of index for that field. For an ascending index on a field, specify a value of ``1``; for @@ -270,7 +271,8 @@ otherwise specified: - document - - Optional. If specified, the indexes only reference documents that match the + - .. _partialFilterExpression: + Optional. If specified, the indexes only reference documents that match the filter expression. See :doc:`/core/index-partial` for more information. diff --git a/source/release-notes/5.0.txt b/source/release-notes/5.0.txt index 683cfd7991c..68cdb068953 100644 --- a/source/release-notes/5.0.txt +++ b/source/release-notes/5.0.txt @@ -293,6 +293,11 @@ truncations. Indexes ------- +Partial Indexes Behavior Change +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +.. include:: /includes/fact-5.0-multiple-partial-index.rst + Cannot Drop ``Ready`` Indexes During In-Progress Index Builds ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ From 1c8a5e007991c2e573db78b0491dc806859e40f1 Mon Sep 17 00:00:00 2001 From: ianf-mongodb <85948430+ianf-mongodb@users.noreply.github.com> Date: Thu, 16 Sep 2021 12:25:51 -0400 Subject: [PATCH 2/3] Update source/reference/method/db.collection.createIndexes.txt Co-authored-by: jeff-allen-mongo --- source/reference/method/db.collection.createIndexes.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/source/reference/method/db.collection.createIndexes.txt b/source/reference/method/db.collection.createIndexes.txt index a9cfa6fa1fb..d6e8376956e 100644 --- a/source/reference/method/db.collection.createIndexes.txt +++ b/source/reference/method/db.collection.createIndexes.txt @@ -272,6 +272,7 @@ otherwise specified: - document - .. _partialFilterExpression: + Optional. If specified, the indexes only reference documents that match the filter expression. See :doc:`/core/index-partial` for more information. From 30fa329055608c082da62f37be2c1124f086ff0d Mon Sep 17 00:00:00 2001 From: ianf-mongodb <85948430+ianf-mongodb@users.noreply.github.com> Date: Thu, 16 Sep 2021 12:25:58 -0400 Subject: [PATCH 3/3] Update source/reference/method/db.collection.createIndexes.txt Co-authored-by: jeff-allen-mongo --- source/reference/method/db.collection.createIndexes.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/source/reference/method/db.collection.createIndexes.txt b/source/reference/method/db.collection.createIndexes.txt index d6e8376956e..b00b4bbe549 100644 --- a/source/reference/method/db.collection.createIndexes.txt +++ b/source/reference/method/db.collection.createIndexes.txt @@ -39,6 +39,7 @@ Definition - document - .. _key_patterns: + An array containing index specification documents. Each document contains field and value pairs where the field is the index key and the value describes the type of index for that