Comments (7)
I've decided to do 2 things:
- Add to the readme the limitation
- Let the user choose the separator see #76
You'll have control on what to use and it not conflicting with your own variable name.
from node-json-db.
datapaths and data are treated differently.
from node-json-db.
I don't see an easy way to resolve this without having to check the key of the object that are push. This could have a huge impact on the performance depending on of the depth and size of the object.
I'll put this as a known issue in the readme.
from node-json-db.
Since searching the object that is pushed has performance issues, and is a pain, you could make a way of escaping the "/" in the key, so that it can be resolved and found.
Naive approach, have the key needing escaping. So if there is a "//" (e.g. "bad//key") it will actually include the / in the keyname (i.e. "bad/key"). The only drawback to this is searching for a empty string key. Though that seems more unlikely than a key with a "/" in it.
from node-json-db.
I see your point, but since the code work by first splitting each part using the slash (/) as glue, it will need a good refactor of the code which I'm not really keen on doing.
It would be easier for the dev to not use the "/" as part of their object key name since it's used as key separator by JsonDB.
from node-json-db.
You process the key from a string to an array by splitting on the "/", the method could be overloaded to accept an array outright, giving some heavy lifting to the user of JsonDB but more usability. So allowing them to pass in an already split data path. This would require little to no refactoring.
from node-json-db.
If this is going to be a known bug, the README.md
should be updated to reflect it.
from node-json-db.
Related Issues (20)
- Error on production server. HOT 1
- "Error: EPERM: operation not permitted" when json-file is opened for viewing in other program HOT 1
- Error on array support HOT 1
- cant use email as a key for search HOT 2
- Concurent apps locking issues HOT 2
- Export core config types to have adapters available HOT 2
- Arrays indexing fails with numeric keys HOT 3
- Can't getIndex if it is array of objects
- Return undefined or null if an item was not found HOT 2
- Get an object in array by value HOT 1
- Request to Open Pull Request Permission for Repository HOT 1
- hope to add an export method HOT 1
- BUG: The Map type is not saved to a file HOT 2
- More resilient `load()`? HOT 1
- Feature request:DB file saving path HOT 2
- Method to read from path like routes to normal path HOT 3
- A new method to concat array on push items HOT 1
- Is there official support/no support for Sets? HOT 2
- Read/Write lock HOT 4
- Do I need to await db.save() after each push, as documented? HOT 1
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 node-json-db.