3

I found some info about limitations for document in Couchbase: /thread/key-length - that the maximum length of the key is 250 bytes. But couldn't find any official one.

  1. Can someone confirm the maximum length of a key for Couchbase document?

  2. What are other limitations for keys, and what are good practices for them?

  3. What about indexes (keys for map functions)?

My use case is that I want to store documents identified by url. The straight forward solution is to indicate the documents by url. Assuming that there are urls bigger than 250 bytes, I need to choose other key - eg md5(url) and put url as an element of the document. Is this good model for Couchbase?

Robert Zaremba
  • 8,081
  • 7
  • 47
  • 78

2 Answers2

2

Yes there is a a 250 byte restriction to keynames in Couchbase Server. Your idea to hash the URLs should work great.

The bytes that make up a key also need to be legal utf-8 (you can store and retrieve non-string keys, but they wont' participate in the full set of Couchbase features, like views and cross datacenter replication).

Key in map reduce views must be utf-8, and are limited to 65kb in length.

J Chris A
  • 2,158
  • 15
  • 14
-2

This isn't a good model for Couchbase. The reason is that Couchbase is meant to be accessed by application servers and not the end user. If you set up Couchbase with an open port then there is nothing stopping someone from modifying or deleting all of the data in your database.

mikewied
  • 5,273
  • 1
  • 20
  • 32
  • I didn't say anything that I want use Couchbase with end users. In fact, my application works only as a background process, not accessible from outside. And I've asked abut how to model the storage for documents. – Robert Zaremba Apr 25 '12 at 09:13
  • My apologies, I misunderstood you question. You seemed to be describing a certain use case that is common for CouchDB. This is why I gave the answer I did. – mikewied Apr 26 '12 at 20:43