Facing issue while inserting data into mongodb

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Critical - P2
    • None
    • Affects Version/s: 2.6.5
    • Component/s: API
    • None
    • Environment:
      Mac 10.6.8 OX
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      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 Glamour_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","Glamour_009");
      BasicDBObject newDocument3 = new BasicDBObject().append("$set", new BasicDBObject(key,arrayObj));
      collection.findAndModify(query, newDocument3);

      But as a result am getting result in some unneeded manner like this

      { "009" : { "Profile" : {"Glamour_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.

              Assignee:
              Unassigned
              Reporter:
              Naveen Kumar
              None
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: