Couchbase
  • Why NoSQL?
  • Couchbase Server
  • Download
  • Resources
  • Careers
Home | Forums | Couchbase | Couchbase Server 1.8.x

check if an item exists

4 replies [Last post]
  • Login or register to post comments
Mon, 06/18/2012 - 01:49
michals
Offline
Joined: 06/14/2012
Groups: None

Hi, is there a way to check if an item exists without using "add" or "touch" or "get"?
thanks

Top
  • Login or register to post comments
Mon, 06/18/2012 - 10:04
ingenthr
Offline
Joined: 03/16/2010
Groups:

There is a feature, currently undocumented (and thus unsupported) called stats key. It may be documented/supported soon, but you can certainly try it in a test environment to see if it works for you. This would allow you to get information about a given key without actually retrieving it. No stats on the key would mean it doesn't exist yet.

Of course, an add with expiration 1 is pretty close if you expect it to not really exist. I know that's not quite right though.

Top
  • Login or register to post comments
Mon, 06/18/2012 - 21:16
michals
Offline
Joined: 06/14/2012
Groups: None

What is exactly the name of this undocumented feature, i couldn't find it?
thanks

Top
  • Login or register to post comments
Mon, 06/18/2012 - 21:33
ingenthr
Offline
Joined: 03/16/2010
Groups:

It's simply an argument to the stats command for the key you want information on.

It's actually documented at a code level right here:
https://github.com/couchbase/ep-engine/blob/master/docs/stats.org#29-sta...

With Open Source, everything is technically documented. :)

Top
  • Login or register to post comments
Mon, 06/18/2012 - 21:34
ingenthr
Offline
Joined: 03/16/2010
Groups:

Oh, and by the way, you can try it from either your client library or the commandline cbstats.

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