englercj / kouch

A descriptive and powerful Object Data Mapper (ODM) for Couchbase.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Arbitrary document keys

englercj opened this issue · comments

Right now a schema is assumed to use _id as the main key. This should be configurable, any field should be able to be the key for a schema, including a custom prefix:

var siteSchema = new kouch.Schema({
      ip: { type: String, key: true, prefix: 'site:'},
      name: String,
      url: String
});

If no field is marked as key then _id should be added and used. If a field is marked as the key is should only be automatically generated if the auto: true property is set.

In progress on feature-custom-keys

Merged!