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

Couchbase .Net client library GetView caching issue

2 replies [Last post]
  • Login or register to post comments
Tue, 07/03/2012 - 07:17
SkeLLLa
Offline
Joined: 06/22/2012
Groups: None

I'm running couchbase server 2.0 (dev preview 4) and using .net client library version 1.2.

When I add some document (json) to my database and then in few seconds (less then 10) I try to get this document via GetView through .net client library and it always returns old value on first query. Only on second query it returns actual value.

When I exec same query through REST api, it returns actual value.

Can anyone provide some information about this?

Top
  • Login or register to post comments
Tue, 07/03/2012 - 10:03
john
Offline
Joined: 01/05/2012
Groups: None

I'm guessing this was also your question? http://stackoverflow.com/questions/11296815/couchbase-net-client-library...

Copying my SO answer below. Let me know if you need any other help...

The default behavior of views in Couchbase is to update the index for a view incrementally. It's requesting a view that actually triggers the incremental update. In other words, when you requested the view the first time, you triggered the index to be updated on the server (only new documents need to be indexed). So the new document(s) was indexed by the time you made the second call to GetVew.

In this way, Couchbase views are eventually consistent. If a stale read is not appropriate or tolerable for your situation, you could use the Stale fluent method when you request the view and modify the default behavior.

So to force the view to be updated before getting results:

var view = client.GetView("beers", "by_name").Stale(StaleMode.False);

Some more info is available at http://www.couchbase.com/docs/couchbase-sdk-net-1.2/api-reference-view.html.

-- John

Top
  • Login or register to post comments
Sun, 02/10/2013 - 21:53
pantonis
Offline
Joined: 02/06/2013
Groups: None

I have the same problem. StaleMode.False did not make the job

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