Couchbase 文档 ID 要求和限制

Couchbase Document ID Requirements and limitations

Couchabse 文档的 ID 字符串有哪些限制?

Couchbase Guide Sample Code:

var properties = new Dictionary<string, object>
{
    {"title", "Little, Big"},
    {"author", "John Crowley"},
    {"published", 1982}
};
var document = database.GetDocument("978-0061120053");
Debug.Assert(document != null);
var rev = document.PutProperties(properties);

关于 var document = database.GetDocument("978-0061120053"); 可以用什么代替 "978-0061120053"

引用 Couchbase Developer guide 这些是键的唯一限制:

  • Keys are strings, typically enclosed by quotes for any given SDK.
  • No spaces are allowed in a key.
  • Separators and identifiers are allowed, such as underscore: ‘person_93847’.
  • A key must be unique within a bucket; if you attempt to store the same key in a bucket, it will either overwrite the value or return an error in the case of add().
  • Maximum key size is 250 bytes. Couchbase Server stores all keys in RAM and does not remove these keys to free up space in RAM. Take this into consideration when you select keys and key length for your
    application.