(self, to_save, manipulate=True, check_keys=True, **kwargs)
Save a document in this collection.

        **DEPRECATED** - Use :meth:`insert_one` or :meth:`replace_one` instead.

        .. versionchanged:: 3.0
           Removed the `safe` parameter. Pass ``w=0`` for unacknowledged write
           operations.
Save a document in this collection.
Save a document in this collection .
def save(self, to_save, manipulate=True, check_keys=True, **kwargs):
        """Save a document in this collection.

        **DEPRECATED** - Use :meth:`insert_one` or :meth:`replace_one` instead.

        .. versionchanged:: 3.0
           Removed the `safe` parameter. Pass ``w=0`` for unacknowledged write
           operations.
        """
        warnings.warn("save is deprecated. Use insert_one or replace_one "
                      "instead", DeprecationWarning, stacklevel=2)
        common.validate_is_document_type("to_save", to_save)

        write_concern = None
        collation = validate_collation_or_none(kwargs.pop('collation', None))
        if kwargs:
            write_concern = WriteConcern(**kwargs)

        with self._socket_for_writes() as sock_info:
            if not (isinstance(to_save, RawBSONDocument) or "_id" in to_save):
                return self._insert(sock_info, to_save, True,
                                    check_keys, manipulate, write_concern)
            else:
                self._update(sock_info, {"_id": to_save["_id"]}, to_save, True,
                             check_keys, False, manipulate, write_concern,
                             collation=collation)
                return to_save.get("_id")
def save ( self , to_save , manipulate = True , check_keys = True , * * kwargs ) : warnings . warn ( "save is deprecated. Use insert_one or replace_one " "instead" , DeprecationWarning , stacklevel = 2 ) common . validate_is_document_type ( "to_save" , to_save ) write_concern = None collation = validate_collation_or_none ( kwargs . pop ( 'collation' , None ) ) if kwargs : write_concern = WriteConcern ( * * kwargs ) with self . _socket_for_writes ( ) as sock_info : if not ( isinstance ( to_save , RawBSONDocument ) or "_id" in to_save ) : return self . _insert ( sock_info , to_save , True , check_keys , manipulate , write_concern ) else : self . _update ( sock_info , { "_id" : to_save [ "_id" ] } , to_save , True , check_keys , False , manipulate , write_concern , collation = collation ) return to_save . get ( "_id" )