[JAVA-2863] insert object inside a array from mongodb java programming Created: 21/May/18  Updated: 11/Sep/19  Resolved: 21/May/18

Status: Closed
Project: Java Driver
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Critical - P2
Reporter: siddareddy Assignee: Unassigned
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate

 Description   

i want to update "d":4 after "c":3
input:
{
"_id" : ObjectId("5b025f11c70c628aeac5f78e"),
"cmd" : [

{ "a" : 1 }

,

{ "b" : 2 }

,

{ "c" : 3 }

]
}
please help me thanks ..



 Comments   
Comment by siddareddy [ 21/May/18 ]

i need to write in java programming

Comment by Ross Lawley [ 21/May/18 ]

Hi sidda,

You can find examples of updating documents in the Quick Tour and I believe  $push is the update operator you require. Be sure to check out the Updates.push helper.

Just to let you know for future referemce the best place for questions regarding MongoDB usage or the Java driver specifics is the mongodb-user mailinglist or stackoverflow as you will reach a boarder audience there. If your business requires an answer from MongoDB within a time frame then we do offer production support.

If you do post to the mailing list or stackoverflow please post a link on this ticket and I will endeavour to follow up there.

All the best,

Ross

Generated at Thu Feb 08 08:58:15 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.