-
-
Notifications
You must be signed in to change notification settings - Fork 7.2k
DELETE request: only remove dependent document + add no cascade flag #756
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Change the DELETE method cascade functionality so it would only delete documents which are dependent on the deleted document. Also added a new flag to disable this cascading delete: "--no-delete-cascade" Updated README and tests. This addresses typicode#725, typicode#721, typicode#578, typicode#545
seems the previous style was valid for node 4 but not 8. this style seems to work for both.
+1 |
+1 |
+1 |
Hi, Or is there a workaround I am not aware of? Kind regards |
This bug still happens, any intention/ETA to merge this? |
This bug still happens today. |
Any chance to merge this ? It is an undocumented behavior that makes some use cases unmanageable ... |
+1 |
1 similar comment
+1 |
Still having this issue. I can use Postman, my own Angular code, and curl. When I delete an unrelated item (ex: http://localhost:3000/items/1001) all items in the entire collection are deleted. I tried --no-cascade-delete to no avail. |
Is there a version available that includes these changes? |
I use --fsk _id to change de default Id |
Thank you Marco. This helps and since i'm not trying to join anything this is fine. if anyone else needs to add this to their server.js this seems to work const router = jsonServer.router(path.join(__dirname, "db.json"), { foreginKeySuffix: "_id" }); |
How can we use --no-cascade-delete in module server.js? const jsonServer = require('json-server')
const server = jsonServer.create()
const router = jsonServer.router('db.json')
const middlewares = jsonServer.defaults()
server.use(middlewares)
server.use(router)
// server.arguments(--no-delete-cascade)
server.listen(5000, () => {
console.log('JSON Server is running')
}) |
Changed the DELETE method cascade functionality so it would only delete documents which are dependent on the deleted document.
Also added a new flag to disable this cascading delete: "--no-delete-cascade"
Updated README to explain this functionality and added tests.
This addresses #760, #725, #721, #578, #545