|
MongoDB\Driver\WriteConcern::bsonSerializeReturns an object for BSON serialization Description
final public stdClass MongoDB\Driver\WriteConcern::bsonSerialize()
ParametersThis function has no parameters. Return ValuesReturns an object for serializing the WriteConcern as BSON. Errors/Exceptions
ExamplesExample #1 MongoDB\Driver\WriteConcern::bsonSerialize with majority write concern The above example will output something similar to:
object(stdClass)#2 (1) {
["w"]=>
string(8) "majority"
}
{ "w" : "majority" }
Example #2 MongoDB\Driver\WriteConcern::bsonSerialize with wtimeout and journal The above example will output something similar to:
object(stdClass)#2 (3) {
["w"]=>
int(2)
["j"]=>
bool(true)
["wtimeout"]=>
int(1000)
}
{ "w" : 2, "j" : true, "wtimeout" : 1000 }
See Also
|