Skip to main content



API for MongoDB

Click here to expand Table of Contents


mod_mongo provides 2 APIs:

  • mongo_find_one
  • mongo_mapreduce

Configuration file mongo.conf.xml

<configuration name="mongo.conf">
connection-string handles different ways to connect to mongo
<param name="connection-string" value="mongodb://"/>
<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;}"/>

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