3
3
4
4
.. TODO fix highlighting
5
5
6
- Connection Settings
6
+ Client Settings
7
7
-------------------
8
- Additional flags may be passed to :class: `pymongo.Connection ` using the
8
+ Additional flags may be passed to :class: `pymongo.MongoClient ` using the
9
9
``OPTIONS `` dictionary::
10
10
11
11
DATABASES = {
@@ -14,27 +14,25 @@ Additional flags may be passed to :class:`pymongo.Connection` using the
14
14
'NAME' : 'my_database',
15
15
...
16
16
'OPTIONS' : {
17
- 'slave_okay' : True,
18
- 'tz_aware' : True,
19
- 'network_timeout' : 42,
17
+ 'socketTimeoutMS' : 500,
20
18
...
21
19
}
22
20
}
23
21
}
24
22
25
23
All of these settings directly mirror PyMongo settings. In fact, all Django
26
24
MongoDB 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 `_.
29
27
30
28
.. _operations-setting :
31
29
32
- Safe Operations (`` getLastError ``)
33
- ----------------------------------
30
+ Acknowledged Operations
31
+ -----------------------
34
32
Use the ``OPERATIONS `` dict to specify extra flags passed to
35
33
:meth: `Collection.save <pymongo.collection.Collection.save> `,
36
34
: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 ):
38
36
39
37
.. code-block :: python
40
38
@@ -43,21 +41,17 @@ Use the ``OPERATIONS`` dict to specify extra flags passed to
43
41
...
44
42
}
45
43
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
+
51
45
52
46
Get a more fine-grained setup by introducing another layer to this dict:
53
47
54
48
.. code-block :: python
55
49
56
50
' OPTIONS' : {
57
51
' OPERATIONS' : {
58
- ' save' : {' safe ' : True },
52
+ ' save' : {' w ' : 3 },
59
53
' update' : {},
60
- ' delete' : {' fsync ' : True }
54
+ ' delete' : {' j ' : True }
61
55
},
62
56
...
63
57
}
@@ -69,10 +63,10 @@ Get a more fine-grained setup by introducing another layer to this dict:
69
63
"`insert vs. update `" into `save `.
70
64
71
65
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/ >`_.
74
68
75
69
.. _Similar to Django's built-in backends :
76
70
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