You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
var sync = require('synchronize');
var db = mongojs(
'mongodb://localhost:3001/'
);
sync.fiber(() => {
const test = sync.await(db.sandbox.insert({
variables: {
'test.var' : 'test'
}
}, sync.defer()));
if (test) console.log(test);
}, (err) => {
if (err) console.log(err);
process.exit();
});
When trying to insert a key name containing '.', the error message is as follows:
Error: key test.var must not contain '.'
at serializeInto (/Users/meganwilson/Desktop/mongo.sandbox/node_modules/bson/lib/bson/parser/serializer.js:913:19)
at serializeObject (/Users/meganwilson/Desktop/mongo.sandbox/node_modules/bson/lib/bson/parser/serializer.js:347:18)
at serializeInto (/Users/meganwilson/Desktop/mongo.sandbox/node_modules/bson/lib/bson/parser/serializer.js:937:17)
at serializeObject (/Users/meganwilson/Desktop/mongo.sandbox/node_modules/bson/lib/bson/parser/serializer.js:347:18)
at serializeInto (/Users/meganwilson/Desktop/mongo.sandbox/node_modules/bson/lib/bson/parser/serializer.js:727:17)
at serializeObject (/Users/meganwilson/Desktop/mongo.sandbox/node_modules/bson/lib/bson/parser/serializer.js:347:18)
at serializeInto (/Users/meganwilson/Desktop/mongo.sandbox/node_modules/bson/lib/bson/parser/serializer.js:937:17)
at BSON.serialize (/Users/meganwilson/Desktop/mongo.sandbox/node_modules/bson/lib/bson/bson.js:63:28)
at Query.toBin (/Users/meganwilson/Desktop/mongo.sandbox/node_modules/mongodb-core/lib/connection/commands.js:140:25)
at Pool.write (/Users/meganwilson/Desktop/mongo.sandbox/node_modules/mongodb-core/lib/connection/pool.js:986:23)
The bug is actually a bug in mongodb-core @2.1.19. Mongojs requires mongodb which requires mongodb-core. After updating to mongodb-core @3.0.9, inserting key names containing '.' no longer threw an error. Upgrading the dependency mongodb to the latest version would update mongodb-core to the latest version which would fix the problem.
The text was updated successfully, but these errors were encountered:
I first thought dat updating a document with a dot key also worked, but its identifying the dot as a subkey. Maybe this is the reason dots are not implemented?
mongojs version: 2.6.0
mongodb version: 3.6.4
Mongojs does not support key names containing '.', even though MongoDB now supports key names containing '.'. (see https://docs.mongodb.com/manual/reference/limits/#Restrictions-on-Field-Names)
When trying to insert a key name containing '.', the error message is as follows:
The bug is actually a bug in
mongodb-core @2.1.19
.Mongojs
requiresmongodb
which requiresmongodb-core
. After updating tomongodb-core @3.0.9
, inserting key names containing '.' no longer threw an error. Upgrading the dependencymongodb
to the latest version would updatemongodb-core
to the latest version which would fix the problem.The text was updated successfully, but these errors were encountered: