Thursday, 1 November 2018

NeDB is unusable because everything has to be callbacks - What am I missing?

I'm using express and nedb and I'm starting to think nedb was a mistake simply because its author has a superstition against synchronous code. But I know in node everything is callbacks so maybe I'm just missing the pattern.I'm using my own template system and the problem is this:I have a route handler function.It tells a model to prep for list-viewing mode.It loads a property using NeDB which has no option other than launching a callback.My controller has nothing else to do.Even forcing a fake sleep function for 25 seconds doesn't fix it.My template populates with no list data.Effectively-infinity later, NeDB finishes reading 24 fields from memoryMy app displays a blank copy of my template, having failed to iterate because there no data.I post mean comments on GithubI just don't understand how OR WHY I'm supposed to tell my code to stick its thumb up its butt for this. Am I missing something sensible here? Or is the author of NeDB just broken when it comes to understanding that many/most database apps in the real world have nothing else to do but wait for data?

Submitted November 02, 2018 at 01:28AM by poor-toy-soul-doll

No comments:

Post a Comment