MongoDb SafeMode compare to WriteConcern

巧了我就是萌 提交于 2019-12-10 14:54:52

问题


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

Thanks.


回答1:


SafeMode.True translates to WriteConcern.Acknowledged.

From the driver source code, SafeMode.cs:

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



回答2:


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.



来源:https://stackoverflow.com/questions/21816233/mongodb-safemode-compare-to-writeconcern

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!