-
Type: New Feature
-
Resolution: Duplicate
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
Empty show more show less
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().
- duplicates
-
NODE-1645 Bson serialisation throw error on inner keys starting with '$'
- Closed
- is documented by
-
NODE-1652 Document checkKeys = false on write operations
- Backlog
- related to
-
SERVER-30575 Please add escaping convention for dot and dollar signs!
- Backlog