mongo-mock
mongo-mock copied to clipboard
Missing DBRef constructor
I use mongo-mock and its awesome, the only thing that I had to add is the db reference constructor that in mongo db is at the same level of the ObjectId constructor, I just wrote this code:
import mongoMockDb from 'mongo-mock';
mongoMockDb.DBRef = function(name, id) {
this.$ref = name;
this.$id = new mongoMockDb.ObjectId(id);
this.oid = id;
};
Maybe you can just add it. Thank you, great job!!
I haven't gone down the DBRef route before- so I'm not too knowledgeable on it. I'm guessing the code you have just silences errors about it?
I'll need to rely on a PR from someone that knows more about it. I'll mark this as Help Wanted.