Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MongoDb SafeMode compare to WriteConcern

Could anyone say how to replace obsolete SafeMode with WriteConcern ? In particular I am interesting in SafeMode.True ?

Thanks.

like image 974
tony Avatar asked Feb 16 '14 20:02

tony


2 Answers

SafeMode.True translates to WriteConcern.Acknowledged.

From the driver source code, SafeMode.cs:

private static SafeMode __true = new SafeMode(WriteConcern.Acknowledged);
like image 58
mnemosyn Avatar answered Oct 10 '22 15:10

mnemosyn


Use the new MongoClient type to connect instead of MongoServer.Create. Write concern will default to acknowledged with MongoClient, which is the equivalent of the obsolete safe mode setting being true.

like image 29
Wes Avatar answered Oct 10 '22 17:10

Wes