Skip site navigation (1)Skip section navigation (2)

  
 
  

home | help
MONGOC_WRITE_CONCERN_T(3)	    libmongoc	       MONGOC_WRITE_CONCERN_T(3)

Write Concern abstraction

SYNOPSIS
     mongoc_write_concern_t  tells  the  driver what level of acknowledgement to
     await from the  server.  The  default,  MONGOC_WRITE_CONCERN_W_DEFAULT,  is
     right for the great majority of applications.

     You  can  specify	a write concern on connection objects, database objects,
     collection objects, or per-operation. Data-modifying  operations  typically
     use  the  write concern of the object they operate on, and check the server
     response for a write concern error or write concern timeout.  For	example,
     mongoc_collection_drop_index()  uses  the collection's write concern, and a
     write concern error or timeout in the response is considered a failure.

     Exceptions to this principle are the generic command functions:

     * mongoc_client_command()

     * mongoc_client_command_simple()

     * mongoc_database_command()

     * mongoc_database_command_simple()

     * mongoc_collection_command()

     * mongoc_collection_command_simple()

     These generic command functions do not automatically apply a write concern,
     and they do not check the server response for  a  write  concern  error  or
     write concern timeout.

     See Write Concern on the MongoDB website for more information.

WRITE CONCERN LEVELS
     Set the write concern level with mongoc_write_concern_set_w().
	    +----------------------------+-----------------------------+
	    | MONGOC_WRITE_CONCERN_W_DE- | By  default,  writes  block |
	    | FAULT (1) 		 | awaiting    acknowledgement |
	    |				 | from  MongoDB. Acknowledged |
	    |				 | write    concern	allows |
	    |				 | clients  to	catch network, |
	    |				 | duplicate  key,  and  other |
	    |				 | errors.		       |
	    +----------------------------+-----------------------------+
	    | MONGOC_WRITE_CONCERN_W_UN- | With  this  write  concern, |
	    | ACKNOWLEDGED (0)		 | MongoDB does  not  acknowl- |
	    |				 | edge  the  receipt of write |
	    |				 | operation.	Unacknowledged |
	    |				 | is  similar	to  errors ig- |
	    |				 | nored; however, mongoc  at- |
	    |				 | tempts  to receive and han- |
	    |				 | dle	network  errors   when |
	    |				 | possible.		       |
	    +----------------------------+-----------------------------+
	    | MONGOC_WRITE_CONCERN_W_MA- | Block  until  a  write  has |
	    | JORITY (majority) 	 | been propagated to a major- |
	    |				 | ity of  the	nodes  in  the |
	    |				 | replica set. 	       |
	    +----------------------------+-----------------------------+
	    | n 			 | Block  until  a  write  has |
	    |				 | been propagated to at least |
	    |				 | n nodes in the replica set. |
	    +----------------------------+-----------------------------+

DEPRECATIONS
     The write concern MONGOC_WRITE_CONCERN_W_ERRORS_IGNORED  (value  -1)  is  a
     deprecated synonym for MONGOC_WRITE_CONCERN_W_UNACKNOWLEDGED (value 0), and
     will be removed in the next major release.

     mongoc_write_concern_set_fsync() is deprecated.

AUTHOR
     MongoDB, Inc

COPYRIGHT
     2009-present, MongoDB, Inc.

1.30.8				  Aug 27, 2026	       MONGOC_WRITE_CONCERN_T(3)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=mongoc_write_concern_t&sektion=3&manpath=FreeBSD+Ports+15.1.quarterly>

home | help