public class MongoDBClient extends Object
Constructor and Description |
---|
MongoDBClient(String url,
String collectionName) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Closes all resources associated with this instance.
|
void |
insert(List<org.bson.Document> documents,
boolean ordered)
Inserts one or more documents.
|
void |
update(org.bson.conversions.Bson filter,
org.bson.conversions.Bson update,
boolean upsert)
Update all documents in the collection according to the specified query filter.
|
public void insert(List<org.bson.Document> documents, boolean ordered)
Inserts one or more documents. This method is equivalent to a call to the bulkWrite method. The documents will be inserted in the order provided, stopping on the first failed insertion.
documents
- public void update(org.bson.conversions.Bson filter, org.bson.conversions.Bson update, boolean upsert)
Update all documents in the collection according to the specified query filter. When upsert set to true, the new document will be inserted if there are no matches to the query filter.
filter
- update
- upsert
- public void close()
Closes all resources associated with this instance.
Copyright © 2019 The Apache Software Foundation. All Rights Reserved.