List of usage examples for com.mongodb.bulk BulkWriteResult getMatchedCount
public abstract int getMatchedCount();
From source file:org.eclipse.ditto.services.thingsearch.persistence.write.streaming.SearchUpdaterStream.java
License:Open Source License
private static String logResult(final BulkWriteResult bulkWriteResult) { return String.format("BulkWriteResult[matched=%d,upserts=%d,inserted=%d,modified=%d,deleted=%d]", bulkWriteResult.getMatchedCount(), bulkWriteResult.getUpserts().size(), bulkWriteResult.getInsertedCount(), bulkWriteResult.getModifiedCount(), bulkWriteResult.getDeletedCount()); }
From source file:org.restheart.handlers.bulk.BulkResultRepresentationFactory.java
License:Open Source License
private void addBulkResult(final BulkOperationResult result, final RequestContext context, final Representation rep, final String requestPath) { Representation nrep = new Representation(); BulkWriteResult wr = result.getBulkResult(); if (wr.wasAcknowledged()) { if (wr.getUpserts() != null) { nrep.addProperty("inserted", new BsonInt32(wr.getUpserts().size())); // add links to new, upserted documents wr.getUpserts().stream().forEach(update -> { nrep.addLink(// w ww .j a v a 2 s. co m new Link("rh:newdoc", URLUtils.getReferenceLink(context, requestPath, update.getId())), true); }); } nrep.addProperty("deleted", new BsonInt32(wr.getDeletedCount())); if (wr.isModifiedCountAvailable()) { nrep.addProperty("modified", new BsonInt32(wr.getModifiedCount())); } nrep.addProperty("matched", new BsonInt32(wr.getMatchedCount())); rep.addRepresentation("rh:result", nrep); } }
From source file:org.restheart.handlers.bulk.BulkResultRepresentationFactory.java
License:Open Source License
private void addWriteResult(final BulkWriteResult wr, final Representation rep, final String requestPath) { Representation nrep = new Representation(); if (wr.wasAcknowledged()) { if (wr.getUpserts() != null) { nrep.addProperty("inserted", new BsonInt32(wr.getUpserts().size())); // add links to new, upserted documents wr.getUpserts().stream().forEach(update -> { nrep.addLink(new Link("rh:newdoc", URLUtils.getReferenceLink(requestPath, update.getId())), true);/*from w w w . j a v a 2 s . co m*/ }); } nrep.addProperty("deleted", new BsonInt32(wr.getDeletedCount())); if (wr.isModifiedCountAvailable()) { nrep.addProperty("modified", new BsonInt32(wr.getModifiedCount())); } nrep.addProperty("matched", new BsonInt32(wr.getMatchedCount())); rep.addRepresentation("rh:result", nrep); } }