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
49 changes: 24 additions & 25 deletions source/core/capped-collections.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ collections work in a way similar to circular buffers: once a
collection fills its allocated space, it makes room for new documents
by overwriting the oldest documents in the collection.

See :method:`db.createCollection()` or :dbcommand:`createCollection`
See :method:`~db.createCollection()` or :dbcommand:`createCollection`
for more information on creating capped collections.

Capped collections have the following behaviors:
Expand Down Expand Up @@ -60,8 +60,8 @@ Recommendations and Restrictions

- You cannot delete documents from a capped collection. To remove all
records from a capped collection, use the 'emptycapped' command. To
remove the collection entirely, use the :method:`drop()
<db.collection.drop()>` method.
remove the collection entirely, use the :method:`~db.collection.drop()`
method.

- You cannot shard a capped collection.

Expand All @@ -74,13 +74,12 @@ Recommendations and Restrictions
.. warning::

If you have a capped collection in a :term:`replica set` outside
of the ``local`` database, before 2.2, you should create a unique
index on ``_id``. Ensure uniqueness using the ``unique: true``
option to the :method:`ensureIndex()
<db.collection.ensureIndex()>` method or by using an
:term:`ObjectId` for the ``_id`` field. Alternately, you can use
the ``autoIndexId`` option to :dbcommand:`create` when creating
the capped collection, as in the
of the ``local`` database, before 2.2, you should create a
unique index on ``_id``. Ensure uniqueness using the ``unique:
true`` option to the :method:`~db.collection.ensureIndex()`
method or by using an :term:`ObjectId` for the ``_id`` field.
Alternately, you can use the ``autoIndexId`` option to
:dbcommand:`create` when creating the capped collection, as in the
:ref:`capped-collections-options` procedure.

- Use natural ordering to retrieve the most recently inserted elements
Expand All @@ -94,12 +93,12 @@ Create a Capped Collection
~~~~~~~~~~~~~~~~~~~~~~~~~~

You must create capped collections explicitly using the
:method:`createCollection() <db.createCollection()>` method, which is
a helper in the :program:`mongo` shell for the :dbcommand:`create`
command. When creating a capped collection you must specify the
maximum size of the collection in bytes, which MongoDB will pre-allocate
for the collection. The size of the capped collection includes a
small amount of space for internal overhead.
:method:`~db.createCollection()` method, which is a helper in the
:program:`mongo` shell for the :dbcommand:`create` command. When
creating a capped collection you must specify the maximum size of the
collection in bytes, which MongoDB will pre-allocate for the collection.
The size of the capped collection includes a small amount of space for
internal overhead.

.. code-block:: javascript

Expand All @@ -117,21 +116,21 @@ collection using the ``max`` field as in the following document:
documents if a collection reaches the maximum size limit before it
reaches the maximum document count.

.. see:: :method:`db.createCollection()` and :dbcommand:`create`.
.. see:: :method:`~db.createCollection()` and :dbcommand:`create`.

.. _capped-collections-options:

Query a Capped Collection
~~~~~~~~~~~~~~~~~~~~~~~~~

If you perform a :method:`find() <db.collection.find()>` on a capped
collection with no ordering specified, MongoDB guarantees that the
ordering of results is the same as the insertion order.
If you perform a :method:`~db.collection.find()` on a capped collection
with no ordering specified, MongoDB guarantees that the ordering of
results is the same as the insertion order.

To retrieve documents in reverse insertion order, issue :method:`find()
<db.collection.find()>` along with the :method:`sort() <cursor.sort()>`
method with the :operator:`$natural` parameter set to ``-1``, as shown in the
following example:
To retrieve documents in reverse insertion order, issue
:method:`~db.collection.find()` along with the :method:`~cursor.sort()`
method with the :operator:`$natural` parameter set to ``-1``, as shown
in the following example:

.. code-block:: javascript

Expand All @@ -140,7 +139,7 @@ following example:
Check if a Collection is Capped
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Use the :method:`db.collection.isCapped()` method to determine if a
Use the :method:`~db.collection.isCapped()` method to determine if a
collection is capped, as follows:

.. code-block:: javascript
Expand Down
52 changes: 25 additions & 27 deletions source/core/document.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ MongoDB contexts:

- arguments to several MongoDB methods and operators, including:

- :ref:`sort order <documents-sort-order>` for the :method:`sort()
<cursor.sort()>` method.
- :ref:`sort order <documents-sort-order>` for the
:method:`~cursor.sort()` method.

- :ref:`index specification <documents-index>` for the
:method:`hint() <cursor.hint()>` method.
:method:`~cursor.hint()` method.

- the output of a number of MongoDB commands and operations, including:

Expand Down Expand Up @@ -264,11 +264,11 @@ select for read, update, and delete operations. You can use
:doc:`query operator </reference/operator>` expressions to specify
additional conditions.

When passed as an argument to methods such as the :method:`find()
<db.collection.find()>` method, the :method:`remove()
<db.collection.remove()>` method, or the :method:`update()
<db.collection.update()>` method, the query document selects documents
for MongoDB to return, remove, or update, as in the following:
When passed as an argument to methods such as
the :method:`~db.collection.find()` method, the
:method:`~db.collection.remove()` method, or the
:method:`~db.collection.update()` method, the query document selects
documents for MongoDB to return, remove, or update, as in the following:

.. code-block:: javascript

Expand All @@ -295,11 +295,10 @@ for MongoDB to return, remove, or update, as in the following:
Update Specification Documents
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Update documents specify the data modifications to perform during
an :method:`update() <db.collection.update()>` operation to modify
existing records in a collection. You can use :ref:`update operators
<update-operators>` to specify the exact actions to perform on the
document fields.
Update documents specify the data modifications to perform during an
:method:`~db.collection.update()` operation to modify existing records
in a collection. You can use :ref:`update operators <update-operators>`
to specify the exact actions to perform on the document fields.

Consider the update document example:

Expand All @@ -313,8 +312,8 @@ Consider the update document example:
}
}

When passed as an argument to the :method:`update()
<db.collection.update()>` method, the update actions document:
When passed as an argument to the :method:`~db.collection.update()`
method, the update actions document:

- Modifies the field ``name`` whose value is another document.
Specifically, the :operator:`$set` operator updates the ``middle``
Expand Down Expand Up @@ -383,9 +382,8 @@ subdocument:

{ _id: 1, 'name.last': 1 }

When passed as an argument to the :method:`ensureIndex()
<db.collection.ensureIndex()>` method, the index documents specifies
the index to create:
When passed as an argument to the :method:`~db.collection.ensureIndex()`
method, the index documents specifies the index to create:

.. code-block:: javascript

Expand All @@ -402,9 +400,9 @@ Sort Order Specification Documents

Sort order documents specify the order of documents that a
:method:`query() <db.collection.find()>` returns. Pass sort order
specification documents as an argument to the :method:`sort()
<cursor.sort()>` method. See the :method:`sort() <cursor.sort()>` page
for more information on sorting.
specification documents as an argument to the :method:`~cursor.sort()`
method. See the :method:`~cursor.sort()` page for more information on
sorting.

The sort order documents contain field and value pairs, in the following
form:
Expand All @@ -425,9 +423,9 @@ by the ``first`` field also ascending:

{ 'name.last': 1, 'name.first': 1 }

When passed as an argument to the :method:`sort() <cursor.sort()>`
When passed as an argument to the :method:`~cursor.sort()`
method, the sort order document sorts the results of the
:method:`find() <db.collection.find()>` method:
:method:`~db.collection.find()` method:

.. code-block:: javascript

Expand Down Expand Up @@ -464,10 +462,10 @@ most international characters in BSON strings with ease.
:operator:`$regex` queries support UTF-8 in the regex string.

.. [#sort-string-internationalization] Given strings using UTF-8
character sets, using :method:`sort() <cursor.sort()>` on strings
will be reasonably correct; however, because internally
:method:`sort() <cursor.sort()>` uses the C++ ``strcmp`` api, the
sort order may handle some characters incorrectly.
character sets, using :method:`~cursor.sort()` on strings will be
reasonably correct; however, because internally :method:`~cursor.sort()`
uses the C++ ``strcmp`` api, the sort order may handle some characters
incorrectly.

.. _document-bson-type-timestamp:

Expand Down
4 changes: 2 additions & 2 deletions source/core/geohaystack.txt
Original file line number Diff line number Diff line change
Expand Up @@ -119,5 +119,5 @@ point, the command would resemble:
</tutorial/calculate-distances-using-spherical-geometry-with-2d-geospatial-indexes>`
are not currently supported by haystack indexes.

The :method:`find() <db.collection.find()>` method and
:dbcommand:`geoNear` command cannot access the haystack index.
The :method:`~db.collection.find()` method and :dbcommand:`geoNear`
command cannot access the haystack index.
22 changes: 11 additions & 11 deletions source/core/indexes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ MongoDB indexes have the following core features:
selects the index empirically by
occasionally running alternate query plans and by selecting the plan
with the best response time for each query type. You can override
the query optimizer using the :method:`cursor.hint()` method.
the query optimizer using the :method:`~cursor.hint()` method.

- An index "covers" a query if:

Expand Down Expand Up @@ -118,7 +118,7 @@ suitable for use as the value of an ``_id`` field.
auto-generated :term:`ObjectId`.

.. [#unique-index-report] Although the index on ``_id`` *is* unique,
the :method:`getIndexes() <db.collection.getIndexes()>` method will
the :method:`~db.collection.getIndexes()` method will
*not* print ``unique: true`` in the :program:`mongo` shell.

.. [#capped-collections] Before version 2.2 capped collections did not
Expand Down Expand Up @@ -149,8 +149,8 @@ and user-facing queries. Doing so requires MongoDB to scan the fewest
number of documents possible.

In the :program:`mongo` shell, you can create an index by calling the
:method:`ensureIndex() <db.collection.ensureIndex()>` method.
Arguments to :method:`ensureIndex() <db.collection.ensureIndex()>`
:method:`~db.collection.ensureIndex()` method.
Arguments to :method:`~db.collection.ensureIndex()`
resemble the following:

.. code-block:: javascript
Expand Down Expand Up @@ -605,8 +605,8 @@ default name.

The resulting index is named: ``inventory``.

To view the name of an index, use the :method:`getIndexes()
<db.collection.getIndexes()>` method.
To view the name of an index, use the
:method:`~db.collection.getIndexes()` method.

.. index:: index; options
.. _index-creation-operations:
Expand All @@ -616,7 +616,7 @@ Index Creation Options
----------------------

You specify index creation options in the second argument in
:method:`ensureIndex() <db.collection.ensureIndex()>`.
:method:`~db.collection.ensureIndex()`.

The options :ref:`sparse <index-type-sparse>`, :ref:`unique
<index-type-unique>`, and :ref:`TTL <index-feature-ttl>` affect the
Expand Down Expand Up @@ -679,10 +679,10 @@ construction:
larger than the available RAM, then the incremental process
can take *much* longer than the foreground build.

- If your application includes :method:`ensureIndex()
<db.collection.ensureIndex()>` operations, and an index *doesn't*
exist for other operational concerns, building the index can have a
severe impact on the performance of the database.
- If your application includes :method:`~db.collection.ensureIndex()`
operations, and an index *doesn't* exist for other operational concerns,
building the index can have a severe impact on the performance of the
database.

Make sure that your application checks for the indexes at start up
using the :method:`~db.collection.getIndexes()` method
Expand Down
Loading