simpl.db icon indicating copy to clipboard operation
simpl.db copied to clipboard

db.getCollection doesn't work after restarting node

Open jumpsplat120 opened this issue 1 year ago • 1 comments

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.

jumpsplat120 avatar Mar 15 '23 19:03 jumpsplat120

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!

5antos avatar Mar 20 '23 00:03 5antos