-
Notifications
You must be signed in to change notification settings - Fork 157
[nano] Implement Support for Document Update Handlers #50
Comments
Personally I like it and think it makes a lot of sense. I just don't know if the name Can you make a pull request that includes necessary tests? I know tests suck right now but I didn't have enough time to port them to Mocha yet! :) Then a blog post introducing this would be great. Version should be Anyone else would like to add opinions? @perezd @pgte @mikeal @PatrickHeneise ? |
Oh and btw, thank you. This is the kind of collaboration that makes everyone love open source :) Welcome to the nano team! ;) |
At the moment I'm using the add-Handler to update documents. An update-Handler certainly makes sense! Great work, thanks! |
I think emphasizing design docs (ie: not relying on generic terminology such as update) is important. My 2 cents! |
@perezd how do you think the interface should look like? |
Oh wow, I totally didn't know about this feature, I thought this was a validate_doc_update design doc thing. |
:) Still what do you think the interface should be? Just |
Btw since we are all kind of here, I've added a Feel free to populate with common cookbook style examples so people can get started faster. |
updateWithHandler? |
Cool, I will create a pull request w/tests and name the public interface name "updateWithHandler" and the private function "update_doc_with_handler"? Sound Good? |
@twilson63 yes! Imho you should make the name I think simplicity should prevail. Your call! :) |
prepared to be shouted at :) there is no such thing as an "UPDATE" in couchDB. the PUT verb, is used for atomic saves, and all changes are atomically versioned, and unique. We have no notion of "updating a key" or things of this nature. So I think its useful to make sure that lexicon is carefully guarded. |
|
[nano] #50 Implement Support for Document Update Handlers
How does this post look, please suggest changes/modifications... http://jackhq.tumblr.com/post/16035106690/nano-v1-2-x-document-update-handler-support-v1-2-x |
Be aware, it is still possible to get conflicts. A document update handler is like a really fast client, it does not change how couchdb works: |
Hey Daniel, Thanks for the heads up, we will continue to test and benchmark, but the Do you have any other suggestions? Thanks Tom On Wed, Jan 18, 2012 at 12:11 AM, Daniel Pfile <
Tom Wilson |
@pfiled While that is useful information it doesn't relate much to nano. If you guys are concerned I would suggest adding a sample to the |
I need to use body data with updateWithHandler. My data can be arbitrarily large so it cannot go into the url. I can fork it for now to get what I need but is there some reason it was not set up as body data in the first place? I can think of no reason to not always use the body. |
@mark-hahn just an oversight, when I implemented it, I was not sending body data, so I did not include that use case. |
It would be cool if params in relax had an option such as _httpBody. Then |
please gist me some code to see what this would mean nice new avatar @perezd |
My code is unfortunately proprietary. Are you looking for an explanation The why is simple. My framework supports updating a doc with an Off the top of my head the how would be ... db.updateWithHandler 'design', 'update', id, { _httpBody: bodydata}, (err, I don't know nano very well, so I couldn't say whether this would be useful I've got everything working here by patching updateWithHandler to send an |
I meant the patch, have no interest in your application code :) I want to understand how big of a change this is, if it means an api change, if it's relevant (the relax method is always there and can be used for uncommon operations, the updatehandler is already uncommon to start with) |
Thanks for the compliment, but most of the credit for that goes to @mikeal for request :) |
I think you (we, I) should just switch the updatehandler call to use the |
Sounds good, those were my concerns. Pull request is welcome! |
feat: add _find
Hello,
I would like to implement support for CouchDb Document Update Handlers.
http://wiki.apache.org/couchdb/Document_Update_Handlers
My thoughts are implementing a new function called update_doc:
Then a public db alias called "update"
usage
This should provide the ability to easily execute atomic updates on the couchdb server:
Document Update Handler in Design Document called my_design_doc:
Then using nano:
Thoughts?
The text was updated successfully, but these errors were encountered: