Skip to content

Commit e1d5468

Browse files
MONGOID-5318 Clarify that index background / background_indexing options are deprecated as of MongoDB 4.2 (#5249)
Co-authored-by: shields <[email protected]>
1 parent 9268fbf commit e1d5468

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

source/reference/configuration.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -260,9 +260,6 @@ for details on driver options.
260260
# if the database name is not explicitly defined. (default: nil)
261261
app_name: MyApplicationName
262262

263-
# Create indexes in background by default. (default: false)
264-
background_indexing: false
265-
266263
# Mark belongs_to associations as required by default, so that saving a
267264
# model with a missing belongs_to association will trigger a validation
268265
# error. (default: true)
@@ -420,6 +417,10 @@ for details on driver options.
420417
# (default: false)
421418
use_utc: false
422419

420+
# (Deprecated) In MongoDB 4.0 and earlier, set whether to create
421+
# indexes in the background by default. (default: false)
422+
background_indexing: false
423+
423424
ERb Preprocessing
424425
=================
425426

source/reference/indexes.txt

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,9 @@ Indexes can be sparse:
6161
index({ ssn: -1 }, { sparse: true })
6262
end
6363

64-
Indexes can be specified to be created in the background in cases where
65-
the collection is large and index creation may take a long time:
64+
*Deprecated:* In MongoDB 4.0 and earlier, users could control whether to build indexes
65+
in the foreground (blocking) or background (non-blocking, but less efficient) using the
66+
``background`` option.
6667

6768
.. code-block:: ruby
6869

@@ -72,9 +73,11 @@ the collection is large and index creation may take a long time:
7273
index({ ssn: 1 }, { unique: true, background: true })
7374
end
7475

75-
If the ``background_indexing`` :ref:`configuration option
76-
<configuration-options>` is true, the indexes are created in the background
77-
unless the ``background: false`` option is provided.
76+
The default value of ``background`` is controlled by Mongoid's
77+
``background_indexing`` :ref:`configuration option <configuration-options>`.
78+
79+
The ``background`` option has `no effect as of MongoDB 4.2
80+
<https://www.mongodb.com/docs/manual/core/index-creation/#comparison-to-foreground-and-background-builds>`_.
7881

7982
*Deprecated:* When using MongoDB 2.6, you can drop the duplicate entries
8083
for unique indexes that are defined for a column that might

0 commit comments

Comments
 (0)