-
Notifications
You must be signed in to change notification settings - Fork 157
[nano] Transaction support? #28
Comments
Yup, definitely. I have some ideas on supporting transactions over REST. Let's talk on IRC and make up a draft for nano/Txn :) |
I'd love to be in on this as well. |
I think we had best discuss it here, in public. I'll start off with brainstorming of ideas. I guess the first concern is that Txn might be a little bit conceptually difficult for new users, for two reasons:
Next, my concern is conceptual misunderstanding.
That is pretty cool and I am using something like this in some places, however:
The final note is that I am still not a regular Nano user (still waiting on that next big couch client project) |
I didn't get the time to review Txn yet but these are so far my overall thoughts on transactions:
function update_user(gh) {
db.view( ''users", "by_github_account", {key: gh.id})
.increment('version', 1)
.replace('github_login', gh.login)
.replace('github', gh.user)
.delete('linkedin.deletemeplease')
.rename('meeutp','meetup')
.push('anarray', 1) // should also include security stuff
.save(
function save_cb(e) {
if(e) {
console.log("Couldn't update ");
return;
}
console.log(gh.id + " updated");
return;
});
}; This should look a lot better than this but would be cool to be able to do something like this. I'll revisit the issue after I check out Txn later this week :) |
Have you seen the library for CouchDB transactions I released yesterday, Txn?
The idea is, instead of having a document and trying to store it, you have an id and you first fetch, then see what it looks like, make some changes, and finally store again. (With automatic retry features.) However, the goal is that your code looks roughly the same.
Do you think it would make sense for Nano to expose this functionality? If so, what do you think the API would look like?
The text was updated successfully, but these errors were encountered: