In a NoSQL db we don\'t have transaction (commit) so I am wondering how db commit the persistence?
when we are telling to db just save the object, it doesn\'t mean it is
I wonder where this meme comes from. First, nothing really guarantees that anything is written to the actual HDD because of all the caching layers, and even traditional RDBMS don't attempt to write to files all the time, otherwise they wouldn't be so fast, but the details vary greatly (see for example adaptive flushing in InnoDB).
You should only concern yourself with the first layer which is essentially the question when the database tries to write to disk. Now there is the first caching layer: Instead of writing into the actual tables/collections, many DBs (including MongoDB) use journaling: Write to an append-only file that will be regularly merged back into the actual data files. In anything goes down and it's in the journal, you're fine.
Now the question is whether you want to write to the journal and how to do it. In MongoDB, you can control this using the write concern, i.e. you can have your application code wait until MongoDB has written to the journal for a specific write (or for all writes). In MongoDB, waiting for the journal commit takes at most 10ms with default configuration if the journal and data files are on different block devices, 33ms if they are on the same block device. The journalCommitInternval
can also be modified if required.
I gathered some details on MongoDB's journalling in another answer.
As a side note, durability doesn't really have a lot to do with transactions. Transactions provide isolation and consistency, e.g. you can change multiple things in one go and readers are guaranteed to get either the new or the old, but not some in-between state. In other words, a transaction-safe database could be an in-memory database which doesn't write to the disk at all.