Skip to content

Commit 15dd0d1

Browse files
author
Sam Kleinman
committed
adding language and support for better indexing of powerOf2Sizes
1 parent 1f2156c commit 15dd0d1

File tree

4 files changed

+33
-16
lines changed

4 files changed

+33
-16
lines changed

.ext/mongodb_domain.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def add_target_and_index(self, name_obj, sig, signode):
108108

109109
def get_index_text(self, objectname, name_obj):
110110
name, obj = name_obj
111-
if self.objtype == 'command':
111+
if self.objtype == 'dbcommand':
112112
return _('%s (database command)') % name
113113
elif self.objtype == 'operator':
114114
return _('%s (operator)') % name
@@ -124,6 +124,8 @@ def get_index_text(self, objectname, name_obj):
124124
return _('%s (shell output)') % (name)
125125
elif self.objtype == 'function':
126126
return _('%s (shell method)') % (name)
127+
elif self.objtype == 'collflag':
128+
return _('%s (collection flag)') % (name)
127129
return ''
128130

129131
def run(self):
@@ -200,6 +202,7 @@ class MongoDBDomain(Domain):
200202
'aggregator': ObjType(l_('aggregator'), 'aggregator'),
201203
'group': ObjType(l_('group'), 'group'),
202204
'expression': ObjType(l_('expression'), 'expression'),
205+
'collflag': ObjType(l_('collflag'), 'collflag'),
203206
}
204207

205208
directives = {
@@ -214,6 +217,7 @@ class MongoDBDomain(Domain):
214217
'aggregator': MongoDBCallable,
215218
'group': MongoDBCallable,
216219
'expression': MongoDBCallable,
220+
'collflag': MongoDBCallable,
217221
}
218222
roles = {
219223
'dbcommand': MongoDBXRefRole(),
@@ -227,6 +231,7 @@ class MongoDBDomain(Domain):
227231
'aggregator': MongoDBXRefRole(),
228232
'group': MongoDBXRefRole(),
229233
'expression': MongoDBXRefRole(),
234+
'collflag': MongoDBXRefRole(),
230235
}
231236
initial_data = {
232237
'objects': {}, # fullname -> docname, objtype

source/reference/commands.txt

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1272,7 +1272,7 @@ Collections
12721272

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

12781278
.. code-block:: javascript
@@ -1286,17 +1286,18 @@ Collections
12861286
.. index:: document; space allocation
12871287
.. index:: usePowerOf2Sizes
12881288
.. _usePowerOf2Sizes:
1289-
1290-
The ``usePowerOf2Sizes`` flag changes the method that MongoDB uses
1291-
to allocate space on disk for documents in this collection. By
1292-
setting ``usePowerOf2Sizes``, you ensure that MongoDB will
1293-
allocates space for documents in sizes that are powers of 2
1294-
(e.g. 4, 8, 16, 32, 64, 128, 512...) With this option MongoDB will
1295-
be able to more effectively reuse space.
1296-
1297-
``usePowerOf2Sizes`` is useful for collection where you will be
1298-
inserting and deleting large numbers of documents to ensure that
1299-
MongoDB will effectively use space on disk.
1289+
.. collflag:: usePowerOf2Sizes
1290+
1291+
The :collflag:`usePowerOf2Sizes` flag changes the method that
1292+
MongoDB uses to allocate space on disk for documents in this
1293+
collection. By setting :collflag:`usePowerOf2Sizes`, you ensure
1294+
that MongoDB will allocates space for documents in sizes that
1295+
are powers of 2 (e.g. 4, 8, 16, 32, 64, 128, 512...) With this
1296+
option MongoDB will be able to more effectively reuse space.
1297+
1298+
:collflag:`usePowerOf2Sizes` is useful for collection where you
1299+
will be inserting and deleting large numbers of documents to
1300+
ensure that MongoDB will effectively use space on disk.
13001301

13011302
Administration
13021303
~~~~~~~~~~~~~~

source/reference/glossary.txt

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -784,8 +784,7 @@ Glossary
784784
belong to a namespace.
785785

786786
replica pairs
787-
The precursor to the MongoDB :term:`replica sets <replica
788-
set>`.
787+
The precursor to the MongoDB :term:`replica sets <replica set>`.
789788

790789
.. deprecated:: 1.6
791790

@@ -818,3 +817,13 @@ Glossary
818817
Geohash
819818
A value is a binary representation of the location on a
820819
coordinate grid.
820+
821+
powerOf2Sizes
822+
A per-:term:`collection` setting that changes and normalizes the
823+
way that MongoDB allocates space for each :term:`document` in an
824+
effort to maximize storage reuse reduce fragmentation. This is
825+
the default for :doc:`TTL Collections </tutorial/expire-data>`.
826+
See :dbcommand:`collMod` and :collflag:`usePowerOf2Sizes` for
827+
more information.
828+
829+
.. versionadded:: 2.2

source/tutorial/expire-data.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ from the collection. You can use this feature to expire data from
2626

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

3133
Constraints
3234
-----------

0 commit comments

Comments
 (0)