mongo-mock icon indicating copy to clipboard operation
mongo-mock copied to clipboard

Missing DBRef constructor

Open yaplas opened this issue 7 years ago • 1 comments

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!!

yaplas avatar Feb 06 '18 17:02 yaplas

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.

williamkapke avatar Feb 24 '18 05:02 williamkapke