when confronted with mongodb, when must i make use of the on queries?

At this time I personally use the 'safe' option just to see if my queries were placed or up-to-date effectively. However, Personally i think this can be over kill.

Must i think that 99% of times, my queries (presuming they're correctly written) is going to be placed/up-to-date, not need to bother about checking when they effectively put?


Presuming whenever you say queries you really mean creates/card inserts (the wording of the question makes me think this) then your Write Concern (safe, none, fsync, etc) may be used to have more speed and fewer safety when that's acceptable, and fewer speed and much more safety when that's necessary.

For example, a hypothetical Facebook-style application can use a hazardous write for "Likes" although it would make use of a safe write for password changes. The logic behind this really is that you will see many 1000 "Like"-style updates happening another, also it does not matter if your are lost, whereas password updates happen less regularly but it's necessary that they succeed.

Therefore, attempt to tailor your Write Concern option to the type of update you do, based on your speed and data integrity needs.

Here's another use situation where unsafe creates are a suitable choice: You're making a lot of creates in very short order. Within this situation you may perform numerous creates, after which call get last error to ascertain if them unsuccessful.

for (Something data : importData) {

If the block works with no exception, then all the data was placed effectively. If there is the best, then a number of from the write procedures unsuccessful, and you will have to retry them (or look into the unique index breach, etc). In tangible existence, you may call getLastError every 10 creates approximately, to prevent needing to resubmit plenty of demands.

This pattern is extremely nice for performance when carrying out bulk card inserts of huge levels of data.

Safe is just necessary on creates, not reads. Queries are just reads.