Advertisement
joseleonweb

Untitled

May 4th, 2021
706
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.42 KB | None | 0 0
  1. MongoClient mongo = new MongoClient("localhost", 27017);
  2. DB db = mongo.getDB("lamevabbdd");
  3. DBCollection table = db.getCollection("persona");
  4. BasicDBObject query = new BasicDBObject();
  5. query.put("name", "mkyong");
  6. BasicDBObject newDocument = new BasicDBObject(); newDocument.put("name", "mkyong-updated");
  7. BasicDBObject updateObj = new BasicDBObject();
  8. updateObj.put("$set", newDocument);
  9. table.update(query, updateObj);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement