Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-1649

Node driver does not allow keys containing dots ('.')

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Duplicate
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None

      Description

      MongoDB allows keys that contain dots:

      Field names can contain dots (i.e. .) and dollar signs (i.e. $).

      Source: https://docs.mongodb.com/manual/reference/limits/#Restrictions-on-Field-Names

      However, the Node driver prohibits them and throws the following error:

      Error: key my.key.with.dots must not contain '.'
          at serializeInto (/usr/src/app/node_modules/mongodb-core/node_modules/bson/lib/bson/parser/serializer.js:914:19)
          at serializeObject (/usr/src/app/node_modules/mongodb-core/node_modules/bson/lib/bson/parser/serializer.js:348:18)
          at serializeInto (/usr/src/app/node_modules/mongodb-core/node_modules/bson/lib/bson/parser/serializer.js:938:17)
          at serializeObject (/usr/src/app/node_modules/mongodb-core/node_modules/bson/lib/bson/parser/serializer.js:348:18)
          at serializeInto (/usr/src/app/node_modules/mongodb-core/node_modules/bson/lib/bson/parser/serializer.js:938:17)
          at serializeObject (/usr/src/app/node_modules/mongodb-core/node_modules/bson/lib/bson/parser/serializer.js:348:18)
          at serializeInto (/usr/src/app/node_modules/mongodb-core/node_modules/bson/lib/bson/parser/serializer.js:728:17)
          at serializeObject (/usr/src/app/node_modules/mongodb-core/node_modules/bson/lib/bson/parser/serializer.js:348:18)
          at serializeInto (/usr/src/app/node_modules/mongodb-core/node_modules/bson/lib/bson/parser/serializer.js:938:17)
          at BSON.serialize (/usr/src/app/node_modules/mongodb-core/node_modules/bson/lib/bson/bson.js:63:28)
          at Query.toBin (/usr/src/app/node_modules/mongodb-core/lib/connection/commands.js:146:25)
          at serializeCommands (/usr/src/app/node_modules/mongodb-core/lib/connection/pool.js:1045:43)
          at Pool.write (/usr/src/app/node_modules/mongodb-core/lib/connection/pool.js:1261:3)
          at executeWrite (/usr/src/app/node_modules/mongodb-core/lib/wireprotocol/3_2_support.js:147:10)
          at WireProtocol.insert (/usr/src/app/node_modules/mongodb-core/lib/wireprotocol/3_2_support.js:158:3)
          at Server.insert (/usr/src/app/node_modules/mongodb-core/lib/topologies/server.js:815:35) 
      

      The operation was a simple collection.insertOne().

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              daniel.aprahamian Daniel Aprahamian (Inactive)
              Reporter:
              nikwen Niklas Wenzel
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: