Skip to main content

mod_mongo

About

API for MongoDB

Click here to expand Table of Contents

API

mod_mongo provides 2 APIs:

  • mongo_find_one
  • mongo_mapreduce

Configuration file mongo.conf.xml

<configuration name="mongo.conf">
<settings>
<!--
connection-string handles different ways to connect to mongo
mongodb://[username:password@]host1[:port1][,host2[:port2],...[,hostN[:portN]]][/[database][?options]]
-->
<param name="connection-string" value="mongodb://127.0.0.1:27017/?connectTimeoutMS=5000"/>
<!--
<param name="map" value="function() { emit(this.a, 1); }"/>
<param name="reduce" value="function(key, values) { return Array.sum(values); }"/>
<param name="finalize" value="function(key, value) { return value;}"/>
-->
</settings>
</configuration>

Compile mod_mongo

mod_mongo require scons and the boost library:

apt-get install scon
apt-get install libboost-all-dev

currently (feb 2013) there's some issues with the build process

before make please run this (tested on Debian 6.0.3 64bit):

export CFLAGS=
export CXXFLAGS=
export LDFLAGS='-lboost_thread -lboost_filesystem-mt -lboost_system-mt'

then run make