Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kjdev/apache-mod-mongo
mod_mongo is mongoDB handler module for Apache HTTPD Server.
https://github.com/kjdev/apache-mod-mongo
Last synced: 25 days ago
JSON representation
mod_mongo is mongoDB handler module for Apache HTTPD Server.
- Host: GitHub
- URL: https://github.com/kjdev/apache-mod-mongo
- Owner: kjdev
- License: apache-2.0
- Created: 2012-05-14T01:50:09.000Z (over 12 years ago)
- Default Branch: master
- Last Pushed: 2012-09-09T23:36:20.000Z (over 12 years ago)
- Last Synced: 2024-11-18T00:52:40.291Z (about 2 months ago)
- Language: C++
- Size: 125 KB
- Stars: 0
- Watchers: 4
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# mod_mongo #
mod_mongo is mongoDB handler module for Apache HTTPD Server.
## Dependencies ##
* [mongoDB driver](http://dl.mongodb.org/dl/cxx-driver)
* [V8](http://code.google.com/p/v8)
* [libapreq2](http://httpd.apache.org/apreq)## Build ##
% ./autogen.sh (or autoreconf -i)
% ./configure [OPTION]
% make
% make install### Build Options ###
mongoDB path.
* --with-mongo=PATH [default=/usr/include]
* --with-mongo-lib=PATH [default=no]V8 path.
* --with-v8=PATH [default=/usr/include]
* --with-v8-lib=PATH [default=no]V8 isolate.
* --enable-v8-isolate [default=no]
apache path.
* --with-apxs=PATH [default=yes]
* --with-apr=PATH [default=yes]
* --with-apreq2=PATH [default=yes]## Configration ##
httpd.conf:
LoadModule v8_module modules/mod_v8.so
MongoHost localhost
MongoPort 27017
MongoTimeout 5
AddHandler mongo-script .mongo## Example ##
test.mongo:
//namespace (#db#.#collection#)
var ns = 'db.collection';//insert
ret = mongo.insert(ns, { test: 'test' });mongo.ap.rputs(ret + "\n");
mongo.ap.rputs(mongo.toJson(ret) + "\n"); //json string//find
ret = mongo.find(ns, {});
for (i = 0; i < ret.length; i++) {
mongo.ap.rputs(mongo.toJson(ret[i]) + "\n");
}//findOne
ret = mongo.findOne(ns, {});
mongo.ap.rputs(mongo.toJson(ret) + "\n");//update
ret = mongo.update(ns, { test: 'test' }, { test: 'TEST', hoge: 'HOGE' });//remove
ret = mongo.remove(ns, {});//findAndModify
ret = mongo.findAndModify(ns, { inprogress: false }, { priority: -1 },
false, { $set: { inprogress: true }, true);