Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions source/reference/method.txt
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,6 @@ Collection

- Removes all indexes on a collection.

* - :method:`db.collection.ensureIndex()`

- Deprecated. Use :method:`db.collection.createIndex()`.

* - :method:`db.collection.explain()`

- Returns information on the query execution of various methods.
Expand Down
26 changes: 3 additions & 23 deletions source/reference/method/db.collection.ensureIndex.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,11 @@ db.collection.ensureIndex()
:depth: 1
:class: singlecol

Definition
----------

.. method:: db.collection.ensureIndex(keys, options)


.. include:: /includes/fact-mongo-shell-method.rst


.. deprecated:: 3.0
.. admonition:: Removed in 5.0

:method:`db.collection.ensureIndex()` has been replaced by
:method:`db.collection.createIndex()`.
Comment on lines 15 to 16

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

• lines 15 and 16 are indented by three too many characters.


Creates an index on the specified field if the index does not
already exist.

Additional Information
----------------------

- Use :method:`db.collection.createIndex()` rather than
:method:`db.collection.ensureIndex()` to create new indexes.

- The :doc:`/indexes` section of this manual for full
documentation of indexes and indexing in MongoDB.
.. seealso::

- :method:`db.collection.getIndexes()` to view the specifications of
existing indexes for a collection.
:method:`db.collection.createIndex()`
6 changes: 1 addition & 5 deletions source/reference/method/js-collection.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,6 @@ Collection Methods

- Removes all indexes on a collection.

* - :method:`db.collection.ensureIndex()`

- Deprecated. Use :method:`db.collection.createIndex()`.

* - :method:`db.collection.explain()`

- Returns information on the query execution of various methods.
Expand Down Expand Up @@ -229,7 +225,6 @@ Collection Methods
/reference/method/db.collection.copyTo
/reference/method/db.collection.count
/reference/method/db.collection.countDocuments
/reference/method/db.collection.estimatedDocumentCount
/reference/method/db.collection.createIndex
/reference/method/db.collection.createIndexes
/reference/method/db.collection.dataSize
Expand All @@ -240,6 +235,7 @@ Collection Methods
/reference/method/db.collection.dropIndex
/reference/method/db.collection.dropIndexes
/reference/method/db.collection.ensureIndex
/reference/method/db.collection.estimatedDocumentCount
/reference/method/db.collection.explain
/reference/method/db.collection.find
/reference/method/db.collection.findAndModify
Expand Down
2 changes: 2 additions & 0 deletions source/release-notes/5.0-compatibility.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ Starting in MongoDB 5.0, these commands are removed:
- :dbcommand:`resetError` and :method:`db.resetError()`. Deprecated
since MongoDB 1.6.

- :method:`db.collection.ensureIndex()` Deprecated since MongoDB 3.0.

Removed Parameters
------------------

Expand Down