We have been using the mongodb / nodejs driver for several years and are currently updating our systems with the latest driver / mongodb database. Basically, everything went well, except for the indices.
We get an error when trying to use a function collection.ensureIndexto add indexes. This is my first question, so I will try to be as detailed as possible. I did not find a related problem ...
Here are our current versions:
- Node: v0.10.33
- Mongodb driver: v2.0.5
- Mongodb Database: v2.4.12
Here is a test case:
var MongoClient = require('mongodb').MongoClient,
test = require('assert');
MongoClient.connect('mongodb://localhost:28888/test', function(err, db) {
var collection = db.collection('ensureIndexEmbedded');
collection.ensureIndex( {"a.c":1}
, {background:true, w:1}, function(err, indexName) {
console.log(err);
db.close();
});
});
And the test run result:
$ node testindex.js
js-bson: Failed to load c++ bson extension, using pure JS version
{ [MongoError: n/a]
name: 'MongoError',
message: 'n/a',
ok: 1,
n: 1,
code: 14,
errmsg: 'key a.c must not contain \'.\'',
writeErrors: [ { index: 0, code: 14, errmsg: 'key a.c must not contain \'.\'' } ] }
Is there a chance the warning js-bson: Failed to load c++ bson extensionis related to this problem? Or is there something wrong with the syntax used to create the index?
!