1.0.14 • Published 6 years ago

ember-cli-couch v1.0.14

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

ember-cli-couch

Addon for CouchDB document API.

$ ember install ember-cli-couch

Setup

// instance-initializers/databases.js
import { registerDatabaseServices } from 'couch';

export default {
  name: 'thing:databases',
  initialize(app) {

    registerDatabaseServices(app, {
      db: {
        url: 'http://127.0.0.1:5984',
        name: 'thing'
      }
    });

    app.lookup('service:db'); // => <thing@couch:database::ember362>
  }
};

Usage

// routes/index.js
import Ember from 'ember';

const {
  RSVP: { hash }
} = Ember;

export default Ember.Route.extend({
  model() {
    return hash({
      database: this.get('db').info(),
      couch:    this.get('db.couch').info(),
      session:  this.get('db.couch.session').load(),
      url:      this.get('db.url')
    });
  }
});

API

Full documentation coming soon.

couches
  couch
    couches
    url
    normalizedUrl
    session
      load()
      save(name, password)
      delete()
    request(opts)
    info()
    uuids(count)
    changes(opts)
    database(name)
      couch
      name
      url
      changes(opts)
      security
        load()
        save(body)
      design
        id(name)
        load(name, opts)
        save(name, json)
        delete(name, opts)
      database
        info()
        create(opts)
        delete(opts)
        recreate(opts)
      mango
        find(opts)
        explain(opts)
        save(ddoc, name, index)
        all()
        delete()
      info()
      load(id, opts)
      save(doc, opts)
      delete(id, rev, opts)
      view(ddoc, name, opts)
      all(opts)

Dummy

See dummy for usage examples and play with window.db:

> db.load('first').then(log)
1.0.14

6 years ago

1.0.13

6 years ago

1.0.12

7 years ago

1.0.11

7 years ago

1.0.10

7 years ago

1.0.9

7 years ago

1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.0

7 years ago

0.0.13

7 years ago

0.0.12

7 years ago

0.0.11

7 years ago

0.0.10

7 years ago

0.0.9

7 years ago

0.0.8

7 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago