Comments (9)
Hello,
This doesn't come as a surprise since nedb is not run in a separate process but instead in the same process as the node application. That means the persistence datafile can be written to by the two processes but an insert on the parent will not be reflected on the child's in-memory cache.
I don't think nedb should automatically be in a separate process though, since its goal is to be lightweight. That said, what we can do is a standalone application that uses nedb to provide a database accessible through HTTP.
I'm not sure I can to that in the near future since there are other priorities for nedb, but I don't think it would take too long so if you want to do it please tell me and when it's finished I'll link to it in nedb's readme.
from nedb.
PS: I was thinking about it again and in fact I don't think that building this cross-application version of nedb makes sense. If you need this, you probably want to use a large scale database such as MongoDB. The goal of nedb is to provide database functionality to small-scale, simple applications and that doesn't seem to be your case.
from nedb.
On the other hand you can setup db on the parent and just pass new entries from child via process.send(insert)
and worker.on('message')
. Not the prettiest way but still should do the trick.
from nedb.
You can certainly do it that way too but that's very custom so I wouldn't want to implement this in nedb. I'm not too sure how a simple application can need to share access to a common database with a child, are you sure mongodb is not the right solution for your needs ?
from nedb.
Application doesn't store a lot of entries in the db and while most of the heavy lifting is done on the forked child process data has to be accessed from the parent. With the nedb application can run in a smaller enviro without requirement for a large db setup.
from nedb.
I see. Since it's very specific, the best way to do it would be for you to manage cross process communication and have only one nedb running, in the child.
from nedb.
Just tested it and works pretty nice. By the way is nedb vulnerable to traditional SQL injection attacks?
from nedb.
No. The only thing that you could think of is putting arbitrary javascript code in a form. But since the serialization/deserialization doesn't use eval
and new Function
(only JSON), this code would never get executed.
from nedb.
Thanks Louis.
from nedb.
Related Issues (20)
- NeDB datastore Model needs to be provided
- update the version of underscore dependence! HOT 1
- How to search multiple feilds' "$and"? HOT 4
- Add link to "official" fork HOT 8
- "this library is no longer maintained" HOT 7
- Insert doesn't take place immediately HOT 2
- How to catch abort if the capacity of storage is full??
- $setOnInsert is not work??????
- high vulnerabilities for this package HOT 2
- Error: Cannot create a string longer than 0x1fffffe8 characters HOT 1
- Please update dependency underscore HOT 4
- files
- Data Loss HOT 1
- Request to move repo under NW Userland
- PLEASE !!! Fork this project and create a new one HOT 1
- How to use expireAfterSeconds?
- i have a probleme to photo to nedb db HOT 1
- Regarding the issue of writing permissions
- Update creates a duplicate with exact same _id HOT 3
- How to switch to mongo
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from nedb.