Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-8101

BSON Obj Behavior while storing data into Database

    XMLWordPrintable

Details

    • Bug
    • Status: Closed
    • Blocker - P1
    • Resolution: Duplicate
    • None
    • None
    • None
    • RHEL 6
    • Linux

    Description

      WE have issue with Holding BSONObj behaviour while holding values for Duplicate keys.

      When we create BSON Obj and append some keys with same name using C++ driver and prints it contains then it shows all four keys with different values.

      when we insert this created BSONObj into mongodb using C++ driver and check contains for perticuler row then it show that all keys having same value i.e. value of first key.

      while the expected behaviour was the inserted row shall contain keys with same name but different values.

      Example :
      void somefuct()

      { DBClientConnection c; c.connect("localhost"); BSONObjBuilder b; b.append("inserTimestamp",1); b.append("inserTimestamp",2); b.append("inserTimestamp",3); b.append("inserTimestamp",4); BSONObj p = b.obj(); cout<<"Data"<<(p.toString()).c_str()<<endl; string strTable = "someDbName"+tablename; c.insert(strTable, p); } below is output for on Consol for COUT: { inserTimestamp: 1, inserTimestamp: 2, inserTimestamp: 3, inserTimestamp: 4 }

      then after insertion below query run from mongclient to display inserted contents of BSONObj
      > db.drill11.find({},

      {"inserTimestamp":1}

      )

      { "_id" : ObjectId("5080e294899514c25a7139e5"), "inserTimestamp" : 1, "inserTimestamp" : 1, "inserTimestamp" : 1, "inserTimestamp" : 1 }

      so table have 4 columns with same keyname and same value which was not expected.

      Kindy let us know on this behavior.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              shr1pad shripad bhargave
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: