I understand that to getlasterror, it guarantees that the write has been done to a file.
我理解为getlasterror,它保证写入已经对一个文件进行了处理。
This means that, even the computer power is off, the previous write is still ok.
这意味着,即使计算机电源关闭了,之前的记录仍然可以。
But what is the use of fsync:true?
但是fsync的用法是什么呢?
1 个解决方案
#1
1
Essentially getLastError checking for an error in last database operation for the current connection. If you will run this command with fsync option it will also flush data to the datafiles (by defaul mongodb do it each 60 seconds).
本质上是getLastError检查当前连接的最后一个数据库操作中的错误。如果您使用fsync选项来运行这个命令,它也会将数据刷新到datafiles(通过defaul mongodb每60秒执行一次)。
More details you can find here and here
你可以在这里和这里找到更多的细节。
#1
1
Essentially getLastError checking for an error in last database operation for the current connection. If you will run this command with fsync option it will also flush data to the datafiles (by defaul mongodb do it each 60 seconds).
本质上是getLastError检查当前连接的最后一个数据库操作中的错误。如果您使用fsync选项来运行这个命令,它也会将数据刷新到datafiles(通过defaul mongodb每60秒执行一次)。
More details you can find here and here
你可以在这里和这里找到更多的细节。