21#include "mongo/client/export_macros.h"
45 static const char kMajority[];
84 const std::string&
mode()
const;
141 static const size_t kNumOptions = 5;
142 enum Options { kW, kWStr, kJ, kFsync, kTimeout };
143 std::bitset<kNumOptions> _enabled;
C++ representation of a "BSON" object – that is, an extended JSON-style object in a binary representa...
Definition bsonobj.h:78
Class to encapsulate client side "Write Concern" concept.
Definition write_concern.h:35
static const WriteConcern acknowledged
A single node acknowledges the write, equivalent to default constructor.
Definition write_concern.h:56
int32_t nodes() const
Returns an integer representing the number of nodes required for write to be considered successful.
const std::string & mode() const
Returns a string representing the write concern mode.
bool journal() const
If write will only be considered successful when committed to journal.
BSONObj obj() const
Turn write concern into an object for inclusion in GetLastError or write command.
WriteConcern()
Default write concern: equivalent to acknowledged.
static const WriteConcern replicated
Two nodes have acknowledged receipt of the write operation.
Definition write_concern.h:62
int32_t timeout() const
Length of time to block waiting for nodes, journal, or fsync.
WriteConcern & timeout(int timeout)
Sets timeout to wait for write to be successful.
bool hasMode() const
Whether the write concern currently reflects a mode.
bool fsync() const
If fsync is set and the server is running without journaling, the write will only be considered succe...
static const WriteConcern unacknowledged
Fire and forget.
Definition write_concern.h:53
WriteConcern & mode(const StringData &w)
Sets the type of nodes required for write to be successful.
WriteConcern & nodes(int w)
Sets the number of nodes required for write to be successful.
bool requiresConfirmation() const
Whether we need to send getLastError for this WriteConcern.
static const WriteConcern majority
A majority of nodes acknowledges (replica set)
Definition write_concern.h:65
WriteConcern & fsync(bool fsync)
Sets the value of the fsync parameter.
WriteConcern & journal(bool j)
Sets whether journal is required for write to be successful.
static const WriteConcern journaled
A single node acknowledges the write operation was committed to journal.
Definition write_concern.h:59
the main MongoDB namespace
Definition bulk_operation_builder.h:24