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

Ability to update views when doc is deleted through couchbase expiration

1 reply [Last post]
  • Login or register to post comments
Fri, 03/15/2013 - 10:18
raghu
Offline
Joined: 03/15/2013
Groups: None

We need a way to detect when CouchBase deletes doc through implicit meta expiration. In such a case, we would like to use a view and emit some data in expired doc as key and value. We will use this to process view data to process report and some related info.

If above is not possible, are there alternatives such as below

- I see that view has access to current meta and current doc in context. Is it possible to read existing view key and update them. Ex - see the commented line

function (doc, meta) {
// newData = get(meta.expiration) + doc.someId
emit(meta.expiration, newData;
}

Is emit(key, value), a set operation implying overwrite. In your example to list recent sessions using views, expiration is used as key in view emits. This wouldn't work if there are more than one session expiring in the same second. Is resolution precision epoch, seconds or milliseconds?

Thanks in advance
Raghu

Top
  • Login or register to post comments
Fri, 03/22/2013 - 01:33
tgrall
Offline
Joined: 09/05/2012
Groups: None

Hello,

This is currently not possible, the view will be only updated when the expiration is "pushed" on disk and the index updated (you can force it with stale=false when calling the view).

You can control the process that delete expired item on disk using the "expiry pager" process. You can find some information here:
http://www.couchbase.com/docs/couchbase-devguide-2.0/about-ttl-values.html

You can control this process using the "exp_pager_stime" parameter:
http://www.couchbase.com/docs/couchbase-manual-2.0/couchbase-admin-cbepc...

regards

__________________

Tug
@tgrall

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