public class MongoDbClient extends Object
| Constructor and Description |
|---|
MongoDbClient(String url,
String collectionName)
The MongoDbClient constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Closes all resources associated with this instance.
|
org.bson.Document |
find(org.bson.conversions.Bson filter)
Finds a single document in the collection according to the specified arguments.
|
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 document,
boolean upsert,
boolean many)
Update a single or all documents in the collection according to the specified arguments.
|
public void insert(List<org.bson.Document> documents, boolean ordered)
documents - documentspublic void update(org.bson.conversions.Bson filter,
org.bson.conversions.Bson document,
boolean upsert,
boolean many)
filter - Bson filterdocument - Bson documentupsert - a new document should be inserted if there are no matches to the query filtermany - whether find all documents according to the query filterpublic org.bson.Document find(org.bson.conversions.Bson filter)
filter - Bson filterpublic void close()
Copyright © 2023 The Apache Software Foundation. All rights reserved.