use of com.mongodb.client.result.DeleteResult in project serverless by bluenimble.
the class MongoDatabaseImpl method delete.
@Override
public int delete(String eType, Object id) throws DatabaseException {
checkNotNull(eType);
if (id == null) {
throw new DatabaseException("can't delete object (missing object id)");
}
MongoCollection<Document> collection = db.getCollection(eType);
if (collection == null) {
return 0;
}
DeleteResult result = collection.deleteOne(eq(DatabaseObjectImpl.ObjectIdKey, new ObjectId(String.valueOf(id))));
return (int) result.getDeletedCount();
}
Aggregations