Circles.io SDK
Allows you to use your api
===
start with setup with a require and your domain with the token
var Circles = require('./lib')
,circles= new Circles("your-url.circles.io","yourToken");
then you can do
Just specify the collection your calling then the data your passing
Create
circles.create(collection,model,options,function(err,result){
console.log(err,result)
})
Read
circles.read(collection,query,options,function(err,result){
console.log(err,result)
})
Update
circles.update(collection,query,options,model,function(err,result){
console.log(err,result)
})
Delete
circles.delete(collection,query,options,function(err,result){
console.log(err,result)
})
The collection is the data collection name (string) :
- item
- instance
- client
- profile
- grid
- blob
- loader
- level
- role
- event
- report
Model is the data that will become the data object (object):
Data that will be saved or updated
The data being updated can be saved with deep model meaning if you have an object
{ name : {
first :"john"
,last :"smith"
}
}
you can update just the first name with :
{ 'name.first':'jane'}
or with arrays you can :
{ toys : ['car','truck','drums'] }
you can update just truck with :
{ 'toys.1':'bus'}
where 1 is the index
Query is the search lookup using normal mongodb queries (object):
Mongo Basic Queries
Mongo Adv Queries
just {} will return all and with the addtion of just
{ _id : ''}
Options (object) [optional]:
- skip (int)
- limit (int)
- sort (object)