collectio
v0.1.13
Published
file base collection for microservices
Readme
Collectio
Data storage for microservices. With an interface similar to JavaScript Objects. All data will be stored in dataDir.
import Collectio from 'colletio'
const dataDir = '/path/to/data/dir'
const Users = new Collectio('users', dataDir)
// _ - is record id
// null as id will create record with new id
// you can specify id if record is not presented it will be created
// if record with given id is presented it will be updated
const rey = Users[null] = {
firstName: 'Rey',
familyName: 'Palpatine'
}
const luke = Users[null] = {
firstName: 'Luke',
familyName: 'Skywalker'
}
Users[rey._] = {
...Users[rey._],
familyName: 'Skywalker'
}
Users.searchSync({
familyName: 'Skywalker'
}, {
limit: 2,
offset: 0,
sort: {_: -1, firstName: 1}
})
delete Users[luke._]