https://github.com/kaosat-dev/cycle-tingodb-driver
tingoDB storage driver for cycle.js
https://github.com/kaosat-dev/cycle-tingodb-driver
Last synced: about 1 year ago
JSON representation
tingoDB storage driver for cycle.js
- Host: GitHub
- URL: https://github.com/kaosat-dev/cycle-tingodb-driver
- Owner: kaosat-dev
- License: mit
- Created: 2015-12-12T12:50:45.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2016-02-14T11:20:07.000Z (over 10 years ago)
- Last Synced: 2025-02-13T14:52:53.217Z (over 1 year ago)
- Language: JavaScript
- Size: 26.4 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## cycle-tingoDB-driver
[](https://badge.fury.io/gh/kaosat-dev%2Fcycle-tingodb-driver)
A [tingoDB](http://www.tingodb.com/) driver for cycle.js
##Notes:
- for **server side** use only !
##Using:
#### Setup:
```js
let drivers = {
db : makeTingoDBDriver("path/to/my/database")
}
Cycle.run(main, drivers)
```
#### In action:
```js
function main(sources) {
sources.db
.filter(res$ => res$.query.method === 'find' && id===72 )// we wanted to find something in the database, and the query had id 72
.mergeAll() // flattens the metastream
.forEach(function(result){
console.log("query result",result)//
})
//Use this type of query to insert data {method:'insert', collectionName:"testCollection", data: {foo:42,bar:"someText"} }
const dbQueries$ = Rx.Observable.interval(1000)
.map(() => {//get data from database
return {method:'find', id:72, collectionName:"testCollection", query:{foo:42}, options:{toArray:true} }
})
return {
db: dbQueries$
}
}
```
For a more advanced usage, check the [tests](https://github.com/kaosat-dev/cycle-tingodb-driver/blob/master/test/index.js) and the [documentation](https://github.com/kaosat-dev/cycle-tingodb-driver/blob/master/docs/api.md).
## LICENSE
[The MIT License (MIT)](https://github.com/kaosat-dev/cycle-tingodb-driver/blob/master/LICENSE)
- - -
[](http://github.com/badges/stability-badges)
[](https://travis-ci.org/kaosat-dev/cycle-tingodb-driver)
[](https://david-dm.org/kaosat-dev/cycle-tingodb-driver)
[](https://david-dm.org/kaosat-dev/cycle-tingodb-driver#info=devDependencies)