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

Possible to create docs with dotted field names

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Duplicate
    • Affects Version/s: 2.5.0
    • Fix Version/s: None
    • Component/s: Internal Client, Write Ops
    • Labels:
      None
    • Operating System:
      ALL

      Description

      conn.update("test.user", BSON("y" << 1), BSON("x" << BSON("a.b" << 1)), true);
      conn.insert("test.user", BSON("x" << BSON("y.z" << 3)));

      And end up with a field you cannot refer to on its own:

      > db.user.find()
      { "_id" : ObjectId("51c85fc622cbaa0259719bca"), "x" : { "a.b" : 1 } }
      { "_id" : ObjectId("51c8627822cbaa0259719bcb"), "x" : { "y.z" : 3 } }
       
      > db.user.find({ 'x.a.b': 1 })
      > db.user.find({ x: { 'a.b': 1 }})
      { "_id" : ObjectId("51c85fc622cbaa0259719bca"), "x" : { "a.b" : 1 } }

      Note: Currently, some drivers already have checks to prevent user from doing this (test on the mongo shell and Ruby driver). Might also want to consider adding the check on the server.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              renctan Randolph Tan
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: