Couchbase
  • Why NoSQL?
  • Couchbase Server
  • Download
  • Resources
  • Careers
Home | Forums | Couchbase | Couchbase Server 2.0

Is there a way to update views without calling them?

2 replies [Last post]
  • Login or register to post comments
Wed, 06/06/2012 - 13:53
hardlifeofapo
Offline
Joined: 04/19/2012
Groups: None

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.

Top
  • Login or register to post comments
Mon, 06/25/2012 - 10:51
mikew
Offline
Joined: 03/14/2011
Groups:

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.

Top
  • Login or register to post comments
Tue, 06/26/2012 - 14:02
hardlifeofapo
Offline
Joined: 04/19/2012
Groups: None

Sure it helped. I'll update a bit of my code in order the add the stale=false argument.

Thanks a lot, mikew

Top
  • Login or register to post comments
  • Login or register to post comments
  • Login
  • Register

Company

  • About Us
  • Leadership
  • Customers
  • Partners
  • Contact Us

Product

  • Couchbase Server
  • Couchbase SDKs
  • Use Cases
  • Documentation
  • Forums

Open Source

  • Couchbase Project
  • Couchbase vs. CouchDB

Commercial

  • Subscriptions & Support
  • Training & Services

News

  • Blog
  • Newsletter
  • Press Releases
  • Buzz

Follow Us

    
  • Customer Login
  • Terms of Service
  • Privacy Policy
  • Trademark Policy
  • Site Map

© 2013 COUCHBASE All rights reserved.

Sign in to Couchbase Community

close
  • Create new account
  • Request new password
You are logging into the Forums, Wiki and Issue Tracker