J
J
jenya77712022-03-28 23:08:40
MongoDB
jenya7771, 2022-03-28 23:08:40

Is it possible in MongoDb using spring data to make an analog of a pessimistic write lock?

Hello, before I change a record, I need to block all other records of one user. I tried to do it by analogy when working with Postgres.

@Repository
public interface UserRepository extends MongoRepository<User, UUID> {
    @Transactional
    @Lock(LockModeType.PESSIMISTIC_WRITE)
    List<ProxyFarmCache> findAllById(UUID id);
}


This option didn't work for me. I couldn't find any other working options. Maybe someone came across, and knows the solution to such a problem?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question