Java Code Examples for com.mongodb.client.result.UpdateResult#wasAcknowledged()
The following examples show how to use
com.mongodb.client.result.UpdateResult#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 | 7 votes |
@Override public boolean updateOrCreate(final Collection<MongoApproval> mongoApprovals) { boolean result = true; for (MongoApproval mongoApproval : mongoApprovals) { final Update update = Update.update("expiresAt", mongoApproval.getExpiresAt()) .set("status", mongoApproval.getStatus()) .set("lastUpdatedAt", mongoApproval.getLastUpdatedAt()); final UpdateResult upsert = mongoTemplate.upsert(byUserIdAndClientIdAndScope(mongoApproval), update, MongoApproval.class); if (!upsert.wasAcknowledged()) { result = false; } } return result; }
Example 2
Source File: MongoApprovalRepositoryImpl.java From spring-security-mongo with MIT License | 5 votes |
@Override public boolean updateExpiresAt(final LocalDateTime expiresAt, final MongoApproval mongoApproval) { final Update update = Update.update("expiresAt", expiresAt); final UpdateResult updateResult = mongoTemplate.updateFirst(byUserIdAndClientIdAndScope(mongoApproval), update, MongoApproval.class); return updateResult.wasAcknowledged(); }
Example 3
Source File: UserRepositoryImpl.java From spring-security-mongo with MIT License | 5 votes |
@Override public boolean changePassword(final String oldPassword, final String newPassword, final String username) { final Query searchUserQuery = new Query(where("username").is(username).andOperator(where("password").is(oldPassword))); final UpdateResult updateResult = mongoTemplate.updateFirst(searchUserQuery, update("password", newPassword), User.class); return updateResult.wasAcknowledged(); }
Example 4
Source File: MongoClientDetailsRepositoryImpl.java From spring-security-mongo with MIT License | 5 votes |
@Override public boolean updateClientSecret(final String clientId, final String newSecret) { final Query query = Query.query(Criteria.where(ID).is(clientId)); final Update update = Update.update(CLIENT_SECRET, newSecret); final UpdateResult updateResult = mongoTemplate.updateFirst(query, update, MongoClientDetails.class); return updateResult.wasAcknowledged(); }
Example 5
Source File: Utils.java From vertx-mongo-client with Apache License 2.0 | 4 votes |
static MongoClientUpdateResult toMongoClientUpdateResult(UpdateResult updateResult) { return updateResult.wasAcknowledged() ? new MongoClientUpdateResult(updateResult.getMatchedCount(), convertUpsertId(updateResult.getUpsertedId()), updateResult.getModifiedCount()) : null; }