I would like to find out how Mongo writes to disk by default. Async or Sync?
When I do:
$collection->insert(array("a" => 42));
is it sync? The documentation says the param w
is set to 1
by default and that should cause the insert
to return only when data has been written to disk. As opposed to w => 0
(Unacknowledged) where data are actually written in an asynchronous way (fire and forget).
So my questions are
- Can anyone confirm my observations above?
- It seems to me it follows that
insert
only throwsMongoCursorException
when in sync mode (w => 1
), am I right?