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

Insert documents without specifying a key like MongoDB with PHP?

1 reply [Last post]
  • Login or register to post comments
Fri, 10/19/2012 - 20:46
codestackr
Offline
Joined: 10/19/2012
Groups: None

Hi there,

Just wondering how would you insert documents into CouchBase buckets without specifying a key like MongoDB?
Can you only filter and index your results using views or can be done through PHP?

Regards,
Vidhya Kumar
NoSQL Enthusiast

Top
  • Login or register to post comments
Sun, 10/21/2012 - 21:23
avsej
avsej's picture
Offline
Joined: 06/15/2011
Groups: None

If you mean let the server generate key for you, no. But you can generate this key on the client side, maintaining counter with INCR and use this id as a part of key (like "user:12345", or use UUID.

Of course you caN index your documents using PHP, but in this case your application need to maintain this index too. For example if you need index on email field you can create additional item for each document, but with key storing email and value with I'd of original doc, or using increment schema above and multi get operation you can query range of the documents

__________________

Find me on FreeNode IRC in #libcouchbase channel

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