/** * Adds a request to update one document in the collection that matches the query with which this builder was created. * * @param update the update criteria */ public void updateOne(final DBObject update) { bulkWriteOperation.addRequest(new UpdateRequest(query, update, false, upsert, queryCodec, collation, arrayFilters)); } }
/** * Adds a request to remove all documents in the collection that match the query with which this builder was created. */ public void remove() { bulkWriteOperation.addRequest(new RemoveRequest(query, true, codec, collation)); }
/** * Adds a request to replace one document in the collection that matches the query with which this builder was created. * * @param document the replacement document, which must be structured just as a document you would insert. It can not contain any * update operators. */ public void replaceOne(final DBObject document) { bulkWriteOperation.addRequest(new ReplaceRequest(query, document, upsert, queryCodec, replacementCodec, collation)); }
/** * Adds a request to update all documents in the collection that match the query with which this builder was created. * * @param update the update criteria */ public void update(final DBObject update) { bulkWriteOperation.addRequest(new UpdateRequest(query, update, true, upsert, queryCodec, collation, arrayFilters)); }
/** * Adds a request to remove one document in the collection that matches the query with which this builder was created. */ public void removeOne() { bulkWriteOperation.addRequest(new RemoveRequest(query, false, codec, collation)); }
/** * Add an insert request to the bulk operation * * @param document the document to insert */ public void insert(final DBObject document) { isTrue("already executed", !closed); if (document.get(ID_FIELD_NAME) == null) { document.put(ID_FIELD_NAME, new ObjectId()); } addRequest(new InsertRequest(document, collection.getObjectCodec())); }
/** * Adds a request to update all documents in the collection that match the query with which this builder was created. * * @param update the update criteria */ public void update(final DBObject update) { bulkWriteOperation.addRequest(new UpdateRequest(query, update, true, upsert, queryCodec, collation, arrayFilters)); }
/** * Adds a request to remove all documents in the collection that match the query with which this builder was created. */ public void remove() { bulkWriteOperation.addRequest(new RemoveRequest(query, true, codec, collation)); }
/** * Adds a request to remove one document in the collection that matches the query with which this builder was created. */ public void removeOne() { bulkWriteOperation.addRequest(new RemoveRequest(query, false, codec, collation)); }
/** * Adds a request to replace one document in the collection that matches the query with which this builder was created. * * @param document the replacement document, which must be structured just as a document you would insert. It can not contain any * update operators. */ public void replaceOne(final DBObject document) { bulkWriteOperation.addRequest(new ReplaceRequest(query, document, upsert, queryCodec, replacementCodec, collation)); }
/** * Adds a request to update one document in the collection that matches the query with which this builder was created. * * @param update the update criteria */ public void updateOne(final DBObject update) { bulkWriteOperation.addRequest(new UpdateRequest(query, update, false, upsert, queryCodec, collation, arrayFilters)); } }
/** * Add an insert request to the bulk operation * * @param document the document to insert */ public void insert(final DBObject document) { isTrue("already executed", !closed); if (document.get(ID_FIELD_NAME) == null) { document.put(ID_FIELD_NAME, new ObjectId()); } addRequest(new InsertRequest(document, collection.getObjectCodec())); }