Closed clocked0ne closed 3 years ago
To be honest this option does next to nothing. It likely did something in back in 2012 but right now all it does is skip emitting the init event on a model. Will get rid of it in the next backwards breaking release.
I've found that if I set skipInit = true when testing with Jest, it doesn't complain when it has finished the unit tests, that there is an open promise. So when I have a node environment variable set to 'test', skipInit is true and there are no complaints. I don't know what it does behind the scenes. I had the recommendation from a stackoverflow question on the subject. I agree, more documentation on the issue would be nice, as I'm not sure if setting to true is causing another problem.
@joe-fenton can you provide me with some example code that demonstrates what you're seeing re: Jest warning about an open promise?
http://mongoosejs.com/docs/api.html
Nowhere in the docs is the purpose of
skipInit
explained properly.What is the purpose of skipping Initialization? What are the use cases and why does it default to false? Is it an optimisation flag? Does it avoid setting schema defaults? This seems like a big oversight to me.
I asked this same question in the Google Group and no one replied in 4 months... this should really be documented properly.