Comments (11)
Hey,
Seems you found your problem.
Can you just post the solution in case anybody encounter it also ?
from node-json-db.
Db.delete() still doesn't work. I am repushing the same value at the momemt to overwrite the old one. If anyone can help with db.delete(), that would be awesome
from node-json-db.
Can I see your code in more details ?
I've added a new test to reproduce your issue, but without success.
505eaf2
The data is deleted as expected.
from node-json-db.
Right I tried using db.getData(`/${role.name}`)
now, and this doesn't work either. for some reason it can't find the name in the db, even though it's clearly there.
Getting this error: [16:04:10] DataError: Can't find dataPath: /test. Stopped at test
from node-json-db.
It's documented.
When the data is not presents it throws a DataError. In other words, the delete did work.
You need to set saveOnPush
at true when creating the instance of JsonDB else the file don't get automatically updated.
Without saveOnPush
at true, you need to save the file manually with the method save
.
from node-json-db.
My file is saved automatically, also I am not using delete()
anymore, i am solely just trying to get the data from the database. Which returns the error.
from node-json-db.
Can you post the content of the json file containing the data ? and the path you're using ?
from node-json-db.
{
"brawlhalla:": "386474258659803136",
"payday2:": "386474384262430720",
"rainbow six siege:": "386474435000926221",
"golf with your friends:": "386474579851476992",
"pubg:": "386474624499580928",
"minecraft:": "386474651464892427",
"left4dead2:": "386474803407880192",
"cs:go:": "386475228156395530",
"gmod:": "386475260125511683",
"pokemon:": "386477372297183236",
"gta5:": "386477952558170122",
"rocket league:": "386522532431527939",
"human fall flat:": "386548983935270914",
"civ 5:": "386551922754060298",
"civ 6:": "386551940059889666",
"the division:": "386583992260100096",
"factorio:": "386658406888374292",
"diablo 3:": "387150515265601546",
"lol:": "387173972023836674",
"nsfw:": "387266630129811466",
"gw2:": "387980499290947586",
"warframe:": "388601035947638785",
"streamer:": "389393132099207169",
"deceit:": "389737810057363456",
"wow:": "389812232600551427",
"borderlands 2:": "390395132773400576",
"dutch:": "401068481598062592",
"ac:unity:": "425252805842829315",
"satellite reign:": "437584040191721472",
"wildlands:": "437651471551430677",
"sc2:": "444924060829483019",
"sonic adventure 2:": "444924563046793226",
"stardew valley:": "444924588330188800",
"doom:": "444924897223901186",
"prey:": "444924905109192724",
"smite:": "445281977466093578",
"warthunder:": "445617611808571403",
"duck game:": "453876642683682819",
"destiny 2:": "465269967961456650",
"trials fusion:": "467055933504356372",
"realm royale:": "468373163106107393",
"se4:": "486955203124527125",
"test:": "488722677205303327"
}```
Create the DB in the following way: `let subbableRolesDB = new jsondb("db/subbableRoles-db", true, true);`
Trying to get the data with the following: `subbableRolesDB.getData(`/${roleName}`);` where `role.name` = `test`
from node-json-db.
From the look of your JSON File I see a direct issue.
All the keys are /xxxx : with a colon (:).
Example:
You wanted test test
but test:
is the one in database.
In your example you're using test
without the colon, hence the issue you're encountering.
You should check your push
in the database to see where that colon is coming from.
from node-json-db.
Welp, i did not see that in the slightest, thanks for noticing that! Guess i overlooked it.
from node-json-db.
No problem, I didn't see it either until I created a specific test with your database :)
I'm closing this.
from node-json-db.
Related Issues (20)
- Load json on different directory
- Nice lib, thanks a lot
- 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
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.