These are chat archives for Automattic/mongoose

28th
Jul 2016
clocked0ne
@clocked0ne
Jul 28 2016 09:06
Does anyone know what the skipInit option actually does when instantiating a Mongoose model?
Documentation is as useful as "skipInit skips initialization" which doesn't explain what that means in practice
@andre-dw You can pass your own Id to ObjectId, but it has to be of the Mongo ObjectId type, either generated by yourself in advance or passed in from an existing doc. If yo do not want to use it then let mongoose use it's own id but also add your own 'CustomId' field and use that, set it as whatever type you want with unique: true, required: true etc in the schema
var id = mongoose.Types.ObjectId();
LeonineKing1199
@LeonineKing1199
Jul 28 2016 15:07
If I had to guess about 'skipInit', I'd assume that if you did new Model({ /* ... */ }), it wouldn't do anything but construct the data without initializing any of the members.
Oh, nope, nvm.
That's wrong.
Who knows, man?
clocked0ne
@clocked0ne
Jul 28 2016 16:23
I am hoping the devs pop their heads in from time to time to explain (or updated the Docs!!)
LeonineKing1199
@LeonineKing1199
Jul 28 2016 17:54
Yeah, the wording is a little ambiguous there because it looks like it's used when defingin a model.