MongoDB Exception caching while updating data -


hello every 1 i'm new mongodb. while updating table have return values in result. return undefined ,but in case of find , insert value in table works properly.

  bands.update({name:'hollywood rose'}, {$set:{year:2000}}, function(err, result) { console.log("result----"+result) // returns undefined         if (!err)      return context.sendjson(result, 404);     })  ; 

this code work in case while update value in table in mongodb did code in playframe work java . hope in case.

    mongoclient mongo=new mongoclient("localhost",27017);     /*mongo.setwriteconcern(writeconcern.journaled);*/     db db = mongo.getdb("webportal");      dbcollection coll=db.getcollection("userdb");     //objectid id= new objectid(userid);      basicdbobject doc2 = new basicdbobject();     doc2.put("_id",userid);     basicdbobject updatedocument = new basicdbobject();     updatedocument .append("$set", new basicdbobject("username", username1).append("password", password1).append("email", email1));     coll.update(doc2, updatedocument); 

Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -