how mongo db does locking for updates/inserts?
According the documentation MongoDB locks the database only when create an index in the foreground ( this option does not exists any more in MongoDB 4.2. ).

On the other hand the collection are never exclusively locks. 

See more what locks are taken on MongoDB on What locks are taken by some common client operations?