Java Code Examples for com.mongodb.client.result.DeleteResult#wasAcknowledged()
The following examples show how to use
com.mongodb.client.result.DeleteResult#wasAcknowledged() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MongoApprovalRepositoryImpl.java From spring-security-mongo with MIT License | 5 votes |
@Override public boolean deleteByUserIdAndClientIdAndScope(final MongoApproval mongoApproval) { final DeleteResult deleteResult = mongoTemplate.remove(byUserIdAndClientIdAndScope(mongoApproval), MongoApproval.class); return deleteResult.wasAcknowledged(); }
Example 2
Source File: MongoClientTemplet.java From mongodb-orm with Apache License 2.0 | 5 votes |
@Override public long delete(String statement, Object parameter) { if (logger.isDebugEnabled()) { logger.debug("Execute 'delete' mongodb command. Statement '" + statement + "'."); } DeleteConfig config = (DeleteConfig) configuration.getStatement(statement); if (config == null) { throw new MongoDaoException(statement, "Delete statement id '" + statement + "' not found."); } String collection = config.getCollection(); NodeEntry query = config.getQuery(); MongoDatabase db = getDatabase(); MongoCollection<Document> coll = db.getCollection(collection).withWriteConcern(WriteConcern.ACKNOWLEDGED); Map<String, Object> q = (Map<String, Object>) query.executorNode(config.getNamespace(), configuration, parameter); Document filter = new Document(q); if (logger.isDebugEnabled()) { logger.debug("Execute 'delete' mongodb command. Query '" + filter + "'."); } DeleteResult result = coll.deleteMany(filter); if (!result.wasAcknowledged()) { throw new MongoDaoException(statement, "Execute 'delete' mongodb command has exception. The write was unacknowledged."); } return result.getDeletedCount(); }
Example 3
Source File: MongoOAuth2AccessTokenRepositoryImpl.java From spring-security-mongo with MIT License | 4 votes |
@Override public boolean deleteByTokenId(final String tokenId) { final Query query = Query.query(Criteria.where(ID).is(tokenId)); final DeleteResult deleteResult = mongoTemplate.remove(query, MongoOAuth2AccessToken.class); return deleteResult.wasAcknowledged(); }
Example 4
Source File: MongoOAuth2AccessTokenRepositoryImpl.java From spring-security-mongo with MIT License | 4 votes |
@Override public boolean deleteByRefreshTokenId(String refreshTokenId) { final Query query = Query.query(Criteria.where("refreshToken").is(refreshTokenId)); final DeleteResult deleteResult = mongoTemplate.remove(query, MongoOAuth2AccessToken.class); return deleteResult.wasAcknowledged(); }
Example 5
Source File: MongoOAuth2ClientTokenRepositoryImpl.java From spring-security-mongo with MIT License | 4 votes |
@Override public boolean deleteByAuthenticationId(final String authenticationId) { final Query query = Query.query(Criteria.where("authenticationId").is(authenticationId)); final DeleteResult deleteResult = mongoTemplate.remove(query, MongoOAuth2ClientToken.class); return deleteResult.wasAcknowledged(); }
Example 6
Source File: MongoClientDetailsRepositoryImpl.java From spring-security-mongo with MIT License | 4 votes |
@Override public boolean deleteByClientId(String clientId) { final Query query = Query.query(Criteria.where(ID).is(clientId)); final DeleteResult deleteResult = mongoTemplate.remove(query, MongoClientDetails.class); return deleteResult.wasAcknowledged(); }
Example 7
Source File: MongoOAuth2RefreshTokenRepositoryImpl.java From spring-security-mongo with MIT License | 4 votes |
@Override public boolean deleteByTokenId(final String tokenId) { final Query query = Query.query(Criteria.where(ID).is(tokenId)); final DeleteResult deleteResult = mongoTemplate.remove(query, MongoOAuth2RefreshToken.class); return deleteResult.wasAcknowledged(); }
Example 8
Source File: Utils.java From vertx-mongo-client with Apache License 2.0 | 4 votes |
static MongoClientDeleteResult toMongoClientDeleteResult(DeleteResult deleteResult) { return deleteResult.wasAcknowledged() ? new MongoClientDeleteResult(deleteResult.getDeletedCount()) : null; }