GetLastErrorCommand class
getLastError command.
Changed in version 2.6: A new protocol for write operations integrates write concerns with the write operations, eliminating the need for a separate getLastError. Most write methods now return the status of the write operation, including error information. In previous versions, clients typically used the getLastError in combination with a write operation to verify that the write succeeded.
Returns the error status of the preceding write operation on the current connection.
The command accepts the following fields:
- db Db
- The database on which the previous write operation ha been executed.
- writeConcern WriteConcern
- When running with replication, this is the number of servers to replicate to before returning. A w value of 1 indicates the primary only. A w value of 2 includes the primary and at least one secondary, etc. In place of a number, you may also set w to majority to indicate that the command should wait until the latest write propagates to a majority of the voting replica set members. If using w, you should also use wtimeout. Specifying a value for w without also providing a wtimeout may cause getLastError to block indefinitely.
- getLastErrorOptions
GetLastErrorOptions
- Optional- a set of optional values for the command
Constructors
-
GetLastErrorCommand(Db db, {WriteConcern? writeConcern, GetLastErrorOptions? getLastErrorOptions, Map<
String, Object> ? rawOptions})
Properties
- canRetryRead → bool
-
no setterinherited
- collection ↔ DbCollection?
-
getter/setter pairinherited
-
command
↔ Map<
String, Object> ? -
getter/setter pairinherited
- connection ↔ Connection?
-
getter/setter pairinherited
- db ↔ Db
-
getter/setter pairinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
-
options
↔ Map<
String, Object> -
getter/setter pairinherited
- readPreference ↔ ReadPreference?
-
getter/setter pairinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- session ↔ Object?
-
getter/setter pairinherited
Methods
-
$buildCommand(
) → Map< String, Object> -
inherited
-
clearSession(
) → void -
inherited
-
execute(
{bool skipStateCheck = false}) → Future< Map< String, dynamic> > -
hasAspect(
Aspect aspect) → bool -
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
processOptions(
Map< String, dynamic> command) → void -
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited