https://github.com/caub/mongo-cli-nodejs
MongoDB web command line interface
https://github.com/caub/mongo-cli-nodejs
Last synced: about 2 months ago
JSON representation
MongoDB web command line interface
- Host: GitHub
- URL: https://github.com/caub/mongo-cli-nodejs
- Owner: caub
- Created: 2014-01-01T01:38:32.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2016-08-18T13:58:58.000Z (almost 10 years ago)
- Last Synced: 2024-04-14T09:03:10.426Z (about 2 years ago)
- Language: JavaScript
- Homepage: http://cyrilauburtin.github.io/mongo-cli-nodejs/
- Size: 19.5 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Mongo-cli
======================
MongoDB from a websocket, with extra features:
- **Access-rights** on documents
- **Notifications**
It works by sending `{fn: someFunction, args: someArguments}` following the syntax of [Mongo's nodejs driver](http://mongodb.github.io/node-mongodb-native/api-generated/collection.html)
Example in javascript:
send({fn:'find', args:[{a: 2}]}, function(d){console.log(d)})
send({fn:'insert', args:[{a:3}]}, function(d){console.log(d)})
send({fn:'find', args:[{a: {$gt:2}}]}, function(d){console.log(d)})
send({fn:'findAndModify', args:[{a:3},null,{$set:{a:5,b:12}},{new:true}]}, function(d){console.log(d)})
send({fn:'findAndModify', args:[{a:6},null,{a:5,b:12},{new:true,upsert:true}]}, function(d){console.log(d)})
send({fn:'remove', args:[{a: {$exists: true}}]}, function(d){console.log(d)})
// when you're authentified, access-rights are enabled
send({fn:'insert', args:[{a:4, _canRemove:['john@gmail.com']}]}, function(d){console.log(d)})
send({fn:'insert', args:[{a:5,_canRead:['john@gmail.com'],_canUpsert:['john@gmail.com'],_canRemove:['john@gmail.com']}]}, function(d){console.log(d)})
//notifications:
// connected clients receive the update when their rights allow it
// note: not all methods will trigger notifications, insert, save, findAndModify, findAndRemove do
// update, remove won't since it just return the number of updates, only the sender receives the response.
Demo server:
- [heroku](http://mongo-cli-nodejs.herokuapp.com/)
- or from [cloud9](https://c9.io/cytr/mongo-cli-nodejs) (and run the file server.js)
Some demo apps using it:
- [Chat](http://jsbin.com/facof/latest)
- [Task list](http://jsbin.com/EduGeZE/latest)
- [Calendar](http://jsbin.com/UmUbipa/latest)
- [Collaborative painting](http://jsbin.com/afiMEWa/latest)
