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

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

    • Type: Icon: New Feature New Feature
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None

      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().

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

              Created:
              Updated:
              Resolved: