...
Code Block | ||
---|---|---|
| ||
// ====== Inserting a list of BSON Documents in Mongodb List<Document> places = Arrays.asList(restaurant1,restaurant2); db.getCollection("restaurants").insertMany(places); |
How to update a document in Mongo with Java?
Code Block | ||
---|---|---|
| ||
db.getCollection("restaurants").updateOne(
new Document("_id",new ObjectId("57bea96d46e0fb000606c68c")),
new Document("$set", new Document("address.street", "East 31st Street"))); |
How to query a document from Mongo with Java?
...