We are using mongoTemplate.findAndModify for our atomic insertion.
Now we face situation on what actions findAndModify did, whether the insert / update operation.
Since findAndModify return the newly inserted or updated document How to identify the document is created newly or updated.
or is there any other option for atomic insertion? we are encountering situation where 3 or more threads are trying to insert the document at the same time. we don’t want the duplicate key exception also, if the document already exists gracefully skips the insertion.