spring-data-mongodb: Method findAndReplace, findAndModify... and auditing

Viewed 530

I have a couple of questions about the method findAndReplace of spring-data-mongodb:

  • Is this operation really atomic?

  • What is the reason for the methods findAndReplace, findAndModify... methods not trigger the auditing event?

     @Autowired
    MongoOperations mongoOperations;
    ...
    public void persist() {
    
            final Query query = new Query();
            query.addCriteria(where("id").is(product.getId()));
    
            mongoOperations.findAndReplace(query, entity, new FindAndReplaceOptions().upsert().returnNew());
    
    
    

Thank you

0 Answers
Related