CouchbaseODM

CouchbaseODM
Type:
CouchbaseODM
CouchbaseODM.CouchbaseODM
static
Type:
CouchbaseODM
Document
Type:
Document
CouchbaseODM.Document
static
Type:
Document
errors
Type:
ErrorList
errors
Type:
ErrorList
CouchbaseODM.errors
static
Type:
ErrorList
CouchbaseODM.errors
static
Type:
ErrorList
Hook
Type:
Hook
CouchbaseODM.Hook
static
Type:
Hook
IncrementalKey
CouchbaseODM.IncrementalKey
static
Instance
Type:
Instance
CouchbaseODM.Instance
static
Type:
Instance
Key
Type:
Key
CouchbaseODM.Key
static
Type:
Key
Model
Type:
Model
CouchbaseODM.Model
static
Type:
Model
modelManager
Type:
ModelManager
CouchbaseODM.ModelManager
static
Type:
ModelManager
ModelManager
Type:
ModelManager
CouchbaseODM.Operation
static
Type:
Operation
Operation
Type:
Operation
CouchbaseODM.RefDocKey
static
Type:
RefDocKey
RefDocKey
Type:
RefDocKey
CouchbaseODM.StorageAdapter
static
StorageAdapter
CouchbaseODM.UUID4Key
static
Type:
UUID4Key
UUID4Key
Type:
UUID4Key
new CouchbaseODM(options)

CouchbaseODM

main enterance to the couchbase-odm

Parameters:
  • options optional
    • Type: Object
      • bucket
        • Type: Bucket
        • must be instance of Couchbase.Bucket (from official nodejs couchbase sdk)

      • key optional
        • Type: Key
        • Default: {UUID4Key}
        • The strategy used for document's key generation. Must inherit from base Key class

      • refDocKey optional
        • Type: RefDocKey
        • Default: RefDocKey
        • The strategy used for reference document key generation. Must inherit from base RefDocKey class

      • timestamps optional
        • Type: boolean
        • Default: true
        • Adds automatically handled timestamp schema properties: created_at, updated_at and if paranoid option is true, deleted_at property

      • paranoid optional
        • Type: boolean
        • Default: false
        • if true is set, a document is not actually removed from bucket but rather deleted_at flag on the document is set. aka. soft delete

      • camelCase optional
        • Type: boolean
        • Default: false
        • if true is set, camel case notation is used for document's internal properties.

      • schemaSettings optional
        • Type: Object
        • allows to modify default values used for document's key generation and document's property names handled by ODM

          • key optional
            • Type: Object
              • prefix optional
                • Type: string
                • Default: defaults to Model's name
                • you most likely do not want to set default value at CouchbaseODM constructor level

              • postfix optional
                • Type: string
                • Default: ""
              • delimiter optional
                • Type: string
                • Default: ""
              • caseSensitive optional
                • Type: boolean
                • Default: true
          • doc optional
            • Type: Object
              • idPropertyName optional
                • Type: string
                • Default: "_id"
                • _id contains generated id of document (not whole document's key)

              • typePropertyName optional
                • Type: string
                • Default: "_type"
                • _type contains the name of a Model

      • hooks optional
        • Type: Object
        • allows to add one or more hooks of a hook type (eg. afterValidate)

      • classMethods optional
        • Type: Object
        • custom method definitions which are bound to a Model.

      • instanceMethods optional
        • Type: Object
        • custom method definitions which are bound to a Instance.

      • indexes optional
        • Type: Object
          • refDocs optional
            • Type: Object
            • Global reference document definitions. Refdoc is a document which reference parent document with its string value(=key). See RefDoc Indexes tutorial for more details

define(name, schema, options)Model

define

builds new Model representing a document(s) in bucket

Parameters:
  • name
    • Type: string
    • name of the model

  • schema
    • Type: Object
    • data schema definition

  • options optional
    • Type: Object
    • see Model for available options

Returns: Model
comments powered by Disqus