@@ -90,7 +90,6 @@ def __init__(self, database, name, create=False, **kwargs):
9090 tag_sets = database .tag_sets ,
9191 secondary_acceptable_latency_ms = (
9292 database .secondary_acceptable_latency_ms ),
93- safe = database .safe ,
9493 uuidrepresentation = database .uuid_subtype ,
9594 ** database .write_concern )
9695
@@ -213,8 +212,7 @@ def initialize_ordered_bulk_op(self):
213212 """
214213 return bulk .BulkOperationBuilder (self , ordered = True )
215214
216- def save (self , to_save , manipulate = True ,
217- safe = None , check_keys = True , ** kwargs ):
215+ def save (self , to_save , manipulate = True , check_keys = True , ** kwargs ):
218216 """Save a document in this collection.
219217
220218 If `to_save` already has an ``"_id"`` then an :meth:`update`
@@ -243,7 +241,6 @@ def save(self, to_save, manipulate=True,
243241 - `to_save`: the document to be saved
244242 - `manipulate` (optional): manipulate the document before
245243 saving it?
246- - `safe` (optional): **DEPRECATED** - Use `w` instead.
247244 - `check_keys` (optional): check if keys start with '$' or
248245 contain '.', raising :class:`~pymongo.errors.InvalidName`
249246 in either case.
@@ -267,6 +264,8 @@ def save(self, to_save, manipulate=True,
267264 - The ``'_id'`` value of `to_save` or ``[None]`` if `manipulate` is
268265 ``False`` and `to_save` has no '_id' field.
269266
267+ .. versionchanged:: 3.0
268+ Removed the `safe` parameter
270269 .. versionadded:: 1.8
271270 Support for passing `getLastError` options as keyword
272271 arguments.
@@ -277,14 +276,14 @@ def save(self, to_save, manipulate=True,
277276 raise TypeError ("cannot save object of type %s" % type (to_save ))
278277
279278 if "_id" not in to_save :
280- return self .insert (to_save , manipulate , safe , check_keys , ** kwargs )
279+ return self .insert (to_save , manipulate , check_keys , ** kwargs )
281280 else :
282281 self .update ({"_id" : to_save ["_id" ]}, to_save , True ,
283- manipulate , safe , check_keys = check_keys , ** kwargs )
282+ manipulate , check_keys = check_keys , ** kwargs )
284283 return to_save .get ("_id" , None )
285284
286285 def insert (self , doc_or_docs , manipulate = True ,
287- safe = None , check_keys = True , continue_on_error = False , ** kwargs ):
286+ check_keys = True , continue_on_error = False , ** kwargs ):
288287 """Insert a document(s) into this collection.
289288
290289 If `manipulate` is ``True``, the document(s) are manipulated using
@@ -312,7 +311,6 @@ def insert(self, doc_or_docs, manipulate=True,
312311 inserted
313312 - `manipulate` (optional): If ``True`` manipulate the documents
314313 before inserting.
315- - `safe` (optional): **DEPRECATED** - Use `w` instead.
316314 - `check_keys` (optional): If ``True`` check if keys start with '$'
317315 or contain '.', raising :class:`~pymongo.errors.InvalidName` in
318316 either case.
@@ -345,6 +343,8 @@ def insert(self, doc_or_docs, manipulate=True,
345343
346344 .. note:: `continue_on_error` requires server version **>= 1.9.1**
347345
346+ .. versionchanged:: 3.0
347+ Removed the `safe` parameter
348348 .. versionadded:: 2.1
349349 Support for continue_on_error.
350350 .. versionadded:: 1.8
@@ -386,7 +386,7 @@ def gen():
386386 ids .append (doc .get ('_id' ))
387387 yield doc
388388
389- safe , options = self ._get_write_mode (safe , ** kwargs )
389+ safe , options = self ._get_write_mode (kwargs )
390390
391391 if client .max_wire_version > 1 and safe :
392392 # Insert command
@@ -412,7 +412,7 @@ def gen():
412412 return ids
413413
414414 def update (self , spec , document , upsert = False , manipulate = False ,
415- safe = None , multi = False , check_keys = True , ** kwargs ):
415+ multi = False , check_keys = True , ** kwargs ):
416416 """Update a document(s) in this collection.
417417
418418 Raises :class:`TypeError` if either `spec` or `document` is
@@ -464,7 +464,6 @@ def update(self, spec, document, upsert=False, manipulate=False,
464464 :class:`~pymongo.errors.InvalidName`. Only applies to
465465 document replacement, not modification through $
466466 operators.
467- - `safe` (optional): **DEPRECATED** - Use `w` instead.
468467 - `multi` (optional): update all documents that match
469468 `spec`, rather than just the first matching document. The
470469 default value for `multi` is currently ``False``, but this
@@ -491,6 +490,8 @@ def update(self, spec, document, upsert=False, manipulate=False,
491490 - A document (dict) describing the effect of the update or ``None``
492491 if write acknowledgement is disabled.
493492
493+ .. versionchanged:: 3.0
494+ Removed the `safe` parameter
494495 .. versionadded:: 1.8
495496 Support for passing `getLastError` options as keyword
496497 arguments.
@@ -517,7 +518,7 @@ def update(self, spec, document, upsert=False, manipulate=False,
517518 if manipulate :
518519 document = self .__database ._fix_incoming (document , self )
519520
520- safe , options = self ._get_write_mode (safe , ** kwargs )
521+ safe , options = self ._get_write_mode (kwargs )
521522
522523 if document :
523524 # If a top level key begins with '$' this is a modify operation
@@ -571,7 +572,7 @@ def drop(self):
571572 """
572573 self .__database .drop_collection (self .__name )
573574
574- def remove (self , spec_or_id = None , safe = None , multi = True , ** kwargs ):
575+ def remove (self , spec_or_id = None , multi = True , ** kwargs ):
575576 """Remove a document(s) from this collection.
576577
577578 .. warning:: Calls to :meth:`remove` should be performed with
@@ -596,7 +597,6 @@ def remove(self, spec_or_id=None, safe=None, multi=True, **kwargs):
596597 - `spec_or_id` (optional): a dictionary specifying the
597598 documents to be removed OR any other type specifying the
598599 value of ``"_id"`` for the document to be removed
599- - `safe` (optional): **DEPRECATED** - Use `w` instead.
600600 - `multi` (optional): If ``True`` (the default) remove all documents
601601 matching `spec_or_id`, otherwise remove only the first matching
602602 document.
@@ -620,6 +620,8 @@ def remove(self, spec_or_id=None, safe=None, multi=True, **kwargs):
620620 - A document (dict) describing the effect of the remove or ``None``
621621 if write acknowledgement is disabled.
622622
623+ .. versionchanged:: 3.0
624+ Removed the `safe` parameter
623625 .. versionadded:: 1.8
624626 Support for passing `getLastError` options as keyword arguments.
625627 .. versionchanged:: 1.7 Accept any type other than a ``dict``
@@ -641,7 +643,7 @@ def remove(self, spec_or_id=None, safe=None, multi=True, **kwargs):
641643 if not isinstance (spec_or_id , dict ):
642644 spec_or_id = {"_id" : spec_or_id }
643645
644- safe , options = self ._get_write_mode (safe , ** kwargs )
646+ safe , options = self ._get_write_mode (kwargs )
645647
646648 client = self .database .connection
647649
0 commit comments