Is there a way to update views without calling them?
Hi everyone,
Yesterday we launched (beta) a project I'm involved in, entirely developed using couchbase 2.0. This morning, we received a call from one of our client that told us she wasn't able to log into the site.
After some research, we discovered that there were two users created in our database, both having a creation date that differs only a few milliseconds and with the same email (which is used as an identifier by our application) and that threw an error that prevented the user from log-in. Finally, we were able to reproduce the error by double-clicking on the "register" button on the website.
This causes two AJAX POST calls to be sent to the server. The first request is received and create the user with the sent email. The second one does exactly the same thing because, although we check for the existence of the sent email on the database, our "users/emails" views is not updated (so the user does not appear to exist) when the second request is received.
Is there any way to prevent this from happening? A way to update the view right after calling a "save" into couchbase? Should I call the view right at the very first line of my register function and wait until it ends to proceed with the rest of the logic? Would the stale=false parameter avoid this?
Any help on this will be really, really appreciated.
Sorry I missed this one. There was a similar question posted here:
http://www.couchbase.com/forums/thread/stalefalse-supported
Can you take a look at my post and let me know if that helps answer your question.