gpt4 book ai didi

c# - 桌面应用程序中的 MongoDB

转载 作者:可可西里 更新时间:2023-11-01 09:47:25 24 4
gpt4 key购买 nike

在 .NET 桌面应用程序中使用 MongoDB 是个好主意吗?

最佳答案

Mongo 旨在通过复制在服务器上运行。它并不是真正打算用作桌面应用程序的数据库(除非它们连接到中央服务器上的数据库)。有一个 blog post on durability在 MongoDB 博客上,这是一个常见问题。

When a write occurs and the write command returns, we can not be 100% sure that from that moment in time on, all other processes will see the updated data only.

在每个驱动程序中,都应该有一个选项来执行“安全”插入或更新,等待数据库响应。我不知道你打算使用哪个驱动程序(有几个用于 .NET,http://github.com/samus/mongodb-csharp 是最受官方支持的),但该驱动程序不提供安全选项,你可以运行 getLastError 命令来手动同步。

MongoDB won’t make sure your data is on the hard drive immediately. As a result, you can lose data that you thought was already written if your server goes down in the period between writing and actual storing to the hard drive.

有一个 fsync 命令,如果你真的需要,你可以在每次操作后运行它。同样,Mongo 秉承“数量安全”的理念,并鼓励任何在生产环境中运行的人至少拥有一个从站作为备份。

关于c# - 桌面应用程序中的 MongoDB,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2491200/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com