33
44.. TODO fix highlighting
55
6- Connection Settings
6+ Client Settings
77-------------------
8- Additional flags may be passed to :class: `pymongo.Connection ` using the
8+ Additional flags may be passed to :class: `pymongo.MongoClient ` using the
99``OPTIONS `` dictionary::
1010
1111 DATABASES = {
@@ -14,27 +14,25 @@ Additional flags may be passed to :class:`pymongo.Connection` using the
1414 'NAME' : 'my_database',
1515 ...
1616 'OPTIONS' : {
17- 'slave_okay' : True,
18- 'tz_aware' : True,
19- 'network_timeout' : 42,
17+ 'socketTimeoutMS' : 500,
2018 ...
2119 }
2220 }
2321 }
2422
2523All of these settings directly mirror PyMongo settings. In fact, all Django
2624MongoDB Engine does is lower-casing the names before passing the flags to
27- :class: `~pymongo.Connection `. For a list of possible options head over to the
28- `PyMongo documentation on connection options `_.
25+ :class: `~pymongo.MongoClient `. For a list of possible options head over to the
26+ `PyMongo documentation on client options `_.
2927
3028.. _operations-setting :
3129
32- Safe Operations (`` getLastError ``)
33- ----------------------------------
30+ Acknowledged Operations
31+ -----------------------
3432Use the ``OPERATIONS `` dict to specify extra flags passed to
3533:meth: `Collection.save <pymongo.collection.Collection.save> `,
3634:meth: `~pymongo.collection.Collection.update ` or
37- :meth: `~pymongo.collection.Collection.remove ` (and thus to `` getLastError `` ):
35+ :meth: `~pymongo.collection.Collection.remove ` (and thus included in the write concern ):
3836
3937.. code-block :: python
4038
@@ -43,21 +41,17 @@ Use the ``OPERATIONS`` dict to specify extra flags passed to
4341 ...
4442 }
4543
46- Since any options to ``getLastError `` imply ``safe=True ``,
47- this configuration passes ``safe=True, w=3 `` as keyword arguments to each of
48- :meth: `~pymongo.collection.Collection.save `,
49- :meth: `~pymongo.collection.Collection.update ` and
50- :meth: `~pymongo.collection.Collection.remove `.
44+
5145
5246 Get a more fine-grained setup by introducing another layer to this dict:
5347
5448.. code-block :: python
5549
5650 ' OPTIONS' : {
5751 ' OPERATIONS' : {
58- ' save' : {' safe ' : True },
52+ ' save' : {' w ' : 3 },
5953 ' update' : {},
60- ' delete' : {' fsync ' : True }
54+ ' delete' : {' j ' : True }
6155 },
6256 ...
6357 }
@@ -69,10 +63,10 @@ Get a more fine-grained setup by introducing another layer to this dict:
6963 "`insert vs. update `" into `save `.
7064
7165
72- A full list of `` getLastError `` flags may be found in the
73- `MongoDB documentation <http://www .mongodb.org/display/DOCS/getLastError+Command >`_.
66+ A full list of write concern flags may be found in the
67+ `MongoDB documentation <http://docs .mongodb.org/manual/core/write-concern/ >`_.
7468
7569.. _Similar to Django's built-in backends :
7670 http://docs.djangoproject.com/en/dev/ref/settings/#std:setting-OPTIONS
77- .. _PyMongo documentation on connection options :
78- http://api.mongodb.org/python/current/api/pymongo/connection .html
71+ .. _PyMongo documentation on client options :
72+ http://api.mongodb.org/python/current/api/pymongo/mongo_client .html
0 commit comments