@@ -61,39 +61,6 @@ Indexes can be sparse:
61
61
index({ ssn: -1 }, { sparse: true })
62
62
end
63
63
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.
67
-
68
- .. code-block:: ruby
69
-
70
- class Person
71
- include Mongoid::Document
72
- field :ssn
73
- index({ ssn: 1 }, { unique: true, background: true })
74
- end
75
-
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>`_.
81
-
82
- *Deprecated:* When using MongoDB 2.6, you can drop the duplicate entries
83
- for unique indexes that are defined for a column that might
84
- already have duplicate values by specifying the ``drop_dups`` option:
85
-
86
- .. code-block:: ruby
87
-
88
- class Person
89
- include Mongoid::Document
90
- field :ssn
91
- index({ ssn: 1 }, { unique: true, drop_dups: true })
92
- end
93
-
94
- The ``drop_dups`` option has been `removed as of MongoDB 3.0
95
- <https://mongodb.com/docs/manual/release-notes/3.0-compatibility/#remove-dropdups-option>`_.
96
-
97
64
For geospatial indexes, make sure the field being indexed is of type Array:
98
65
99
66
.. code-block:: ruby
@@ -126,6 +93,25 @@ This only works on the association macro that the foreign key is stored on:
126
93
has_and_belongs_to_many :preferences, index: true
127
94
end
128
95
96
+ *Deprecated:* In MongoDB 4.0 and earlier, users could control whether to build indexes
97
+ in the foreground (blocking) or background (non-blocking, but less efficient) using the
98
+ ``background`` option.
99
+
100
+ .. code-block:: ruby
101
+
102
+ class Person
103
+ include Mongoid::Document
104
+ field :ssn
105
+ index({ ssn: 1 }, { unique: true, background: true })
106
+ end
107
+
108
+ The default value of ``background`` is controlled by Mongoid's
109
+ ``background_indexing`` :ref:`configuration option <configuration-options>`.
110
+
111
+ The ``background`` option has `no effect as of MongoDB 4.2
112
+ <https://www.mongodb.com/docs/manual/core/index-creation/#comparison-to-foreground-and-background-builds>`_.
113
+
114
+
129
115
Index Management Rake Tasks
130
116
===========================
131
117
0 commit comments