I need to create an index in MongoDB to store unique slugs.
I use this code to generate the index:
this._db = db;
this._collection = this._db.collection("Topics");
this._collection.ensureIndex( { slug: 1 }, { unique: true });
But when I run my tests it fails on the "beforeEach": (I'm using mongo-clean NPM)
beforeEach(function (done) {
clean(dbURI, function (err, created) {
db = created;
instance = topicManager(db);
done(err);
});
});
Saying:
Uncaught Error: Cannot use a writeConcern without a provided callback
What am I doing wrong? (if I comment the ensureIndex everything works)