1.4.1 • Published 6 years ago

save-usergrid v1.4.1

Weekly downloads
4
License
ISC
Repository
github
Last release
6 years ago

save-usergrid

Build Status

Usergrid persistance engine for save

Installation

npm install save-usergrid

Usage

var save = require('save') // npm install save
  , usergrid = require('save-usergrid')
  , collection = 'contacts'
  , auth =
    { host: 'https://localhost'
    , org: 'org'
    , app: 'app'
    , grantType: 'client_credentials'
    , clientId: 'client'
    , clientSecret: 'such secret, much wow'
    }

// Create a save instance and pass in a Usergrid engine.
var contactStore = save('Contact', { engine: usergrid(collection, auth) })

// Then we can create a new entity.
contactStore.create({ name: 'James', email: 'jamesmortemore@gmail.com'}, function (error, contact) {

  // The created 'contact' is returned and has been given a uuid
  console.log(contact)
})

// Lets find that entity with a query
contactStore.findOne('SELECT * WHERE name = James', function (error, contact) {
  // Will be the entity created above
  console.log(contact)
})

// Lets update the entity
contactStore.read('1234-1234-1234-1235', function (error, contact) {
  contact.name = 'Jamez'

  contactStore.update(contact, function (error, updatedContact) {
    console.log(updatedContact)
  })
})

// Lets delete the entity
contactStore.delete('1234-1234-1234-1235', function (error, contact) {
  // Entire entity that was deleted
  console.log(contact)
})
1.4.1

6 years ago

1.4.0

6 years ago

1.3.0

7 years ago

1.2.0

7 years ago

1.1.0

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago