开发者

What commit styles are available in MongoDB?

In some sense, the default "save" operation appears to be asynchronous in MongoDB. It seems that when a client sav开发者_如何学JAVAes a document, it will typically receive a successful response immediately from the server, even if the operation has not yet been applied to the database (let alone committed to disk).

(I'm basing this model for how save() behaves on the PHP client documentation, which contains an optional parameter--safe--which I think does ensure that the save has been processed by the server, rather than merely received by the server, and a blog post comment by Mathias Stearn in which he says "By default 'commited' just means applied to the mmaped structure, but it can also mean replicated or flushed to disk.")

I can see that there are several levels of "success" a save() might reach, including: (a) sent by client; (b) received by server; (c) committed by server to internal datastructures; (d) sent by server to n replicas; and (e) committed to disk.

  • What does MongoDB do by default?
  • How can this be tuned? (I couldn't find an equivalent for PHP's safe mode in the mongo shell, for example.)

Also, is there ever any difference in behaviour toward the client issuing the save(), and any other client? i.e. does MongoDB support read-your-own-writes, or similar?


All of these options are done w/ the getLastError command. That is basically what "safe mode" does under the hood. This page should be helpful: http://www.mongodb.org/display/DOCS/getLastError+Command

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜