class SimpleMongoLock extends AbstractSimpleLock {

  @Override
  protected boolean release(final String key, final String storeId, final String token) {
    final var deleted = mongoTemplate.remove(Query.query(Criteria.where("_id").is(key).and("token").is(token)), storeId);
    final var released = deleted.getDeletedCount() == 1;
    if (released) {
      log.debug("Remove query successfully affected 1 record for key {} with token {} in store {}", key, token, storeId);
    } else if (deleted.getDeletedCount() > 0) {
      log.error("Unexpected result from release for key {} with token {} in store {}, released {}", key, token, storeId, deleted);
    } else {
      log.error("Remove query did not affect any records for key {} with token {} in store {}", key, token, storeId);
    }

    return released;
  }

  public  SimpleMongoLock(final Supplier<String> tokenSupplier, final MongoTemplate mongoTemplate);

}