Documented that it is possible to specify a name when using a dict to define an index

This commit is contained in:
Bastien Gérard 2018-08-30 23:13:10 +02:00
parent 60fe919992
commit bd524d2e1e
2 changed files with 4 additions and 1 deletions

View File

@ -513,6 +513,9 @@ If a dictionary is passed then the following options are available:
Allows you to automatically expire data from a collection by setting the
time in seconds to expire the a field.
:attr:`name` (Optional)
Allows you to specify a name for the index
.. note::
Inheritance adds extra fields indices see: :ref:`document-inheritance`.

View File

@ -215,7 +215,7 @@ class query_counter(object):
"""Get the number of queries."""
ignore_query = {'ns': {'$ne': '%s.system.indexes' % self.db.name}}
count = self.db.system.profile.find(ignore_query).count() - self.counter
self.counter += 1
self.counter += 1 # Account for the query we just fired
return count