Skip to content
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

Invoking update function when changing document in Fauxton #5041

Open
hubodz opened this issue Apr 28, 2024 · 3 comments
Open

Invoking update function when changing document in Fauxton #5041

hubodz opened this issue Apr 28, 2024 · 3 comments

Comments

@hubodz
Copy link

hubodz commented Apr 28, 2024

Hello,
I would like to add a simple functionality using update function in design document. I would like it to be invoked when a document is changed/created in Fauxton.
Normally, one has to call the update function explicitly, but this (I believe) not possible with Fauxton.

Is there any way to achieve behaviour described above? Maybe it's possible to set an update function as default, so it doesn't require explicit call?

Thanks!

@rnewson
Copy link
Member

rnewson commented Apr 28, 2024

It is not possible. Clients must call through to the appropriate _update handler url explicitly.

@hubodz
Copy link
Author

hubodz commented Apr 28, 2024

Thank you!
Do you think the idea I described could be proposed as enhancement to Couch, or there are reasons to not go that way?

@rnewson
Copy link
Member

rnewson commented Apr 29, 2024

The idea has come up before but it is has always been rejected, for similar reasons to your other ticket.

What you can do is use a validate_doc_update function to ensure only valid updates are made (you can compare the new incoming update to the current document to ensure any state transition constraints) and provide an update handler to your clients to make it easier to create a valid update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants