[JAVA-770] Facing issue while inserting data into mongodb Created: 24/Feb/13  Updated: 26/Feb/13  Resolved: 26/Feb/13

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

Type: Bug Priority: Critical - P2
Reporter: Naveen Kumar Assignee: Barrie Segal
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Mac 10.6.8 ox



 Description   

Hi,
I have an object inside my mongodb like this
{ "_id" : ObjectId("5129d8a4da06f4571f45d1a2"),
"User_Id" : {
"Profile" :

{ "Naveen_009": }

} }.
Now i want to check the profile value is Naveen_009,if result is true i want to insert data like this
"Twitter" :

{ "08 Feb 2013" : [ 11, 10, 0, 1 ], "09 Feb 2013" : [ 890, 546, 35, 309 ], "10 Feb 2013" : [ 728, 458, 30, 240 ] }

.
To do this am using following logic.
BasicDBObject query =new BasicDBObject().append("009.Profile","Naveen_009");
BasicDBObject newDocument3 = new BasicDBObject().append("$set", new BasicDBObject(key,arrayObj));
collection.findAndModify(query, newDocument3);
But as a result am getting result in some unwanted manner like this

{ "009" : { "Profile" : {"Naveen_009": }

,
"08 Feb 2013" : [ 1253, 857, 55, 341 ],
"09 Feb 2013" : [ 890, 546, 35, 309 ],
"10 Feb 2013" : [ 728, 458, 30, 240 ] },
"_id" : ObjectId("5129bf1dda06f4709d2b98ee") }
Help me to get required result if u suggest some books it il be help full too.



 Comments   
Comment by Barrie Segal [ 26/Feb/13 ]

Hi Naveen!

Our drivers projects are reserved for feature requests and bug reports. If you'd like someone to help you troubleshoot this issue, I'd recommend posting it on one of our community support channels:

  1. MongoDB Google group: https://groups.google.com/forum/?fromgroups#!forum/mongodb-user
  1. Stack Overflow, with 'mongodb' tag: http://stackoverflow.com/questions/tagged/mongodb

Once you post on our Google group or on SO, please paste a link to the question in this ticket so we can take a look asap.

Thanks!

Barrie

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