java - How to insert a single field into a JSON using MongoTemplate? -
so, making program, trying learn more spring , mongodb. have built ticked module, uses mongodb store ticket info in json format. looks this:
> { > "_id" : objectid("581fb1a24beb291d27f95a50"), > "userid" : "581ddccb4beb29112a7b4f77", > "ticketstatus" : "processing", > "ticketsolution" : "not_solved", > "ticketcomment" : null; > }
my question how insert comment "ticketcomment" field? (i need uses criteria.where("ticketid").is(ticketid))
with simplest details use :-
criteria.where("ticketid").is(ticketid)); query query = new query(criteria); basicdbobject newvalues = new basicdbobject(columnname,value); basicdbobject set = new basicdbobject("$set", newvalues); update update = new basicupdate(set); mongooperations.updatemulti(query, update, "collectionname")
Comments
Post a Comment