tony
tony

Reputation: 359

MongoDb SafeMode compare to WriteConcern

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

Thanks.

Upvotes: 6

Views: 1471

Answers (2)

Wes
Wes

Reputation: 731

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.

Upvotes: 2

mnemosyn
mnemosyn

Reputation: 46311

SafeMode.True translates to WriteConcern.Acknowledged.

From the driver source code, SafeMode.cs:

private static SafeMode __true = new SafeMode(WriteConcern.Acknowledged);

Upvotes: 6

Related Questions