@@ -630,11 +630,26 @@ def profiling_info(self):
630630 return list (self ["system.profile" ].find ())
631631
632632 def error (self ):
633- """Get a database error if one occured on the last operation.
633+ """**DEPRECATED**: Get the error if one occurred on the last operation.
634+
635+ This method is obsolete: all MongoDB write operations (insert, update,
636+ remove, and so on) use the write concern ``w=1`` and report their
637+ errors by default.
638+
639+ This method must be called in the same
640+ :doc:`request </examples/requests>` as the preceding operation,
641+ otherwise it is unreliable. Requests are deprecated and will be removed
642+ in PyMongo 3.0.
634643
635644 Return None if the last operation was error-free. Otherwise return the
636645 error that occurred.
646+
647+ .. versionchanged:: 2.8
648+ Deprecated.
637649 """
650+ warnings .warn ("Database.error() is deprecated" ,
651+ DeprecationWarning , stacklevel = 2 )
652+
638653 error = self .command ("getlasterror" ,
639654 read_preference = ReadPreference .PRIMARY )
640655 error_msg = error .get ("err" , "" )
@@ -645,32 +660,79 @@ def error(self):
645660 return error
646661
647662 def last_status (self ):
648- """Get status information from the last operation.
663+ """**DEPRECATED**: Get status information from the last operation.
664+
665+ This method is obsolete: all MongoDB write operations (insert, update,
666+ remove, and so on) use the write concern ``w=1`` and report their
667+ errors by default.
668+
669+ This method must be called in the same
670+ :doc:`request </examples/requests>` as the preceding operation,
671+ otherwise it is unreliable. Requests are deprecated and will be removed
672+ in PyMongo 3.0.
649673
650674 Returns a SON object with status information.
675+
676+ .. versionchanged:: 2.8
677+ Deprecated.
651678 """
679+ warnings .warn ("last_status() is deprecated" ,
680+ DeprecationWarning , stacklevel = 2 )
681+
652682 return self .command ("getlasterror" ,
653683 read_preference = ReadPreference .PRIMARY )
654684
655685 def previous_error (self ):
656- """Get the most recent error to have occurred on this database.
686+ """**DEPRECATED**: Get the most recent error on this database.
687+
688+ This method is obsolete: all MongoDB write operations (insert, update,
689+ remove, and so on) use the write concern ``w=1`` and report their
690+ errors by default.
691+
692+ This method must be called in the same
693+ :doc:`request </examples/requests>` as the preceding operation,
694+ otherwise it is unreliable. Requests are deprecated and will be removed
695+ in PyMongo 3.0. Furthermore, the underlying database command
696+ ``getpreverror`` will be removed in a future MongoDB release.
657697
658698 Only returns errors that have occurred since the last call to
659- `Database. reset_error_history`. Returns None if no such errors have
699+ :meth:` reset_error_history`. Returns None if no such errors have
660700 occurred.
701+
702+ .. versionchanged:: 2.8
703+ Deprecated.
661704 """
705+ warnings .warn ("previous_error() is deprecated" ,
706+ DeprecationWarning , stacklevel = 2 )
707+
662708 error = self .command ("getpreverror" ,
663709 read_preference = ReadPreference .PRIMARY )
664710 if error .get ("err" , 0 ) is None :
665711 return None
666712 return error
667713
668714 def reset_error_history (self ):
669- """Reset the error history of this database.
715+ """**DEPRECATED**: Reset the error history of this database.
670716
671- Calls to `Database.previous_error` will only return errors that have
717+ This method is obsolete: all MongoDB write operations (insert, update,
718+ remove, and so on) use the write concern ``w=1`` and report their
719+ errors by default.
720+
721+ This method must be called in the same
722+ :doc:`request </examples/requests>` as the preceding operation,
723+ otherwise it is unreliable. Requests are deprecated and will be removed
724+ in PyMongo 3.0. Furthermore, the underlying database command
725+ ``reseterror`` will be removed in a future MongoDB release.
726+
727+ Calls to :meth:`previous_error` will only return errors that have
672728 occurred since the most recent call to this method.
729+
730+ .. versionchanged:: 2.8
731+ Deprecated.
673732 """
733+ warnings .warn ("reset_error_history() is deprecated" ,
734+ DeprecationWarning , stacklevel = 2 )
735+
674736 self .command ("reseterror" ,
675737 read_preference = ReadPreference .PRIMARY )
676738
0 commit comments