Skip to content

adding language and support for better indexing of powerOf2Sizes #95

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 30, 2012
Merged
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
7 changes: 6 additions & 1 deletion .ext/mongodb_domain.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def add_target_and_index(self, name_obj, sig, signode):

def get_index_text(self, objectname, name_obj):
name, obj = name_obj
if self.objtype == 'command':
if self.objtype == 'dbcommand':
return _('%s (database command)') % name
elif self.objtype == 'operator':
return _('%s (operator)') % name
Expand All @@ -124,6 +124,8 @@ def get_index_text(self, objectname, name_obj):
return _('%s (shell output)') % (name)
elif self.objtype == 'function':
return _('%s (shell method)') % (name)
elif self.objtype == 'collflag':
return _('%s (collection flag)') % (name)
return ''

def run(self):
Expand Down Expand Up @@ -200,6 +202,7 @@ class MongoDBDomain(Domain):
'aggregator': ObjType(l_('aggregator'), 'aggregator'),
'group': ObjType(l_('group'), 'group'),
'expression': ObjType(l_('expression'), 'expression'),
'collflag': ObjType(l_('collflag'), 'collflag'),
}

directives = {
Expand All @@ -214,6 +217,7 @@ class MongoDBDomain(Domain):
'aggregator': MongoDBCallable,
'group': MongoDBCallable,
'expression': MongoDBCallable,
'collflag': MongoDBCallable,
}
roles = {
'dbcommand': MongoDBXRefRole(),
Expand All @@ -227,6 +231,7 @@ class MongoDBDomain(Domain):
'aggregator': MongoDBXRefRole(),
'group': MongoDBXRefRole(),
'expression': MongoDBXRefRole(),
'collflag': MongoDBXRefRole(),
}
initial_data = {
'objects': {}, # fullname -> docname, objtype
Expand Down
25 changes: 13 additions & 12 deletions source/reference/commands.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1272,7 +1272,7 @@ Collections

:dbcommand:`collMod` makes it possible to add flags to a collection
to modify the behavior of MongoDB. In the current release the only
available flag is ``usePowerof2Sizes``. The command takes the
available flag is :collflag:`usePowerof2Sizes`. The command takes the
following prototype form:

.. code-block:: javascript
Expand All @@ -1286,17 +1286,18 @@ Collections
.. index:: document; space allocation
.. index:: usePowerOf2Sizes
.. _usePowerOf2Sizes:

The ``usePowerOf2Sizes`` flag changes the method that MongoDB uses
to allocate space on disk for documents in this collection. By
setting ``usePowerOf2Sizes``, you ensure that MongoDB will
allocates space for documents in sizes that are powers of 2
(e.g. 4, 8, 16, 32, 64, 128, 512...) With this option MongoDB will
be able to more effectively reuse space.

``usePowerOf2Sizes`` is useful for collection where you will be
inserting and deleting large numbers of documents to ensure that
MongoDB will effectively use space on disk.
.. collflag:: usePowerOf2Sizes

The :collflag:`usePowerOf2Sizes` flag changes the method that
MongoDB uses to allocate space on disk for documents in this
collection. By setting :collflag:`usePowerOf2Sizes`, you ensure
that MongoDB will allocates space for documents in sizes that
are powers of 2 (e.g. 4, 8, 16, 32, 64, 128, 512...) With this
option MongoDB will be able to more effectively reuse space.

:collflag:`usePowerOf2Sizes` is useful for collection where you
Copy link
Contributor

Choose a reason for hiding this comment

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

collection == collections

Also, do you mean to link back to :collflag:usePowerOf2Sizes within the same block which is the primary documentation (we discussed this general concept last week)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ah, so generally, if its a reference to an object (as indexed by Sphinx,) then linking (as in this case) also changes the typesetting (makes it bold, and preformated/code) so those items are always linked. The docs are very consistent on this practice.

Glossary items (i.e. :term:) are only linked once per-section, (i.e. the first time the term appears after someone could have started to read by virtue of arriving on a page via a target link.) The docs are less consistent on this point, particularly with regards to some really common terms/ideas (collections, databases.)

will be inserting and deleting large numbers of documents to
ensure that MongoDB will effectively use space on disk.

Administration
~~~~~~~~~~~~~~
Expand Down
13 changes: 11 additions & 2 deletions source/reference/glossary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -784,8 +784,7 @@ Glossary
belong to a namespace.

replica pairs
The precursor to the MongoDB :term:`replica sets <replica
set>`.
The precursor to the MongoDB :term:`replica sets <replica set>`.

.. deprecated:: 1.6

Expand Down Expand Up @@ -818,3 +817,13 @@ Glossary
Geohash
A value is a binary representation of the location on a
coordinate grid.

powerOf2Sizes
A per-:term:`collection` setting that changes and normalizes the
way that MongoDB allocates space for each :term:`document` in an
effort to maximize storage reuse reduce fragmentation. This is
the default for :doc:`TTL Collections </tutorial/expire-data>`.
See :dbcommand:`collMod` and :collflag:`usePowerOf2Sizes` for
more information.

.. versionadded:: 2.2
4 changes: 3 additions & 1 deletion source/tutorial/expire-data.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ from the collection. You can use this feature to expire data from

Use the ``expireAfterSeconds`` option to the :func:`ensureIndex
<db.collection.ensureIndex()>` method in conjunction with a TTL value
in seconds to create an expiring collection.
in seconds to create an expiring collection. Additionally, TTL
collections have the collection flag :collflag:`usePowerOf2Sizes` set
to support more efficient storage reuse.

Constraints
-----------
Expand Down