Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
MongoDb: How to save directly from json
Mongo mongo = new Mongo("",27017);
DB db = mongo.getDB("yabe");
DBCollection collection = db.getCollection("pt");
DBCursor csr = collection.find();
for (DBObject dbObject : csr) {
WriteResult save = BasicDBObject() {{
this.append("user", 333);
save = BasicDBObject() {{
this.append("user", "ikeda");
WSRequest url = play.libs.WS.url("");
final HttpResponse httpResponse = url.get();
final Object parse = JSON.parse(httpResponse.getString().replaceAll("\\.", "_")); parse);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment