https://github.com/influx6/tagdb
a server and client simplified db library
https://github.com/influx6/tagdb
Last synced: 7 months ago
JSON representation
a server and client simplified db library
- Host: GitHub
- URL: https://github.com/influx6/tagdb
- Owner: influx6
- License: other
- Created: 2014-08-11T10:52:40.000Z (about 11 years ago)
- Default Branch: master
- Last Pushed: 2014-09-25T18:18:50.000Z (about 11 years ago)
- Last Synced: 2025-01-21T07:08:07.596Z (9 months ago)
- Language: Dart
- Size: 184 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
#TagDB
A simple library based on the idea that database interfaces need not be that complicated.
Current supports mongo,redis and couchdb, couchbase support is still in the mix##Examples
A simple mongodb tagdb instance and request approach```
/* Located in .test/mongo.dart file */
var mongo = TagDB.create('mongo',{
'url':"mongodb://127.0.0.1/mydb",
'port': 27017
});
mongo.open().then(Funcs.tag('booting mongodb')).then((f){mongo.query({
'@':'insert',
'db': 'mydb',
'data':{'name':'john','age':31}
}).then(Funcs.tag('mydb-insert'));mongo.query({
'@':'all',
'db':'mydb',
}).then(Funcs.tag('mydb-all'));mongo.query({
'@':'findOne',
'db': 'mydb'
}).then(Funcs.tag('mydb-findone'));mongo.query({
'@':'update',
'db': 'mydb',
'criteria': [{'name':'alex'},{'\$set':{'status':'single'}},{'multiUpdate': true}]
}).then(Funcs.tag('mydb-update'));mongo.query({
'@':'find',
'db': 'mydb',
'criteria':[{'status': 'single'}]
});return mongo.query({
'@':'drop',
'db': 'mydb',
}).then(Funcs.tag('dropped my-db'));
}).then(Funcs.tag('mydb-drop')).then((n){
mongo.end().then((f)=> print('ending mongo'));
}).catchError(Funcs.tag('mongodb error'));```