simpl.db
simpl.db copied to clipboard
db.getCollection doesn't work after restarting node
When creating a collection, adding something to it, and then restarting the server, the collection is no longer available through getCollection. You have to use createCollection on initial load, regardless of if the collection was previously created or not.
Proposed fix: When the database is initialized, iterate through the collection folder and prepopulate the db.collections array with whatever collections are found in the folder.
Greetings! Thanks for your issue in advance. Currently all the developed approaches throughout the project work in that way (excluding query methods). However, I actually see your point and it makes total sense. That being said, I'll rewrite the code to use that approach consistently, including your suggestion!