1
0
mirror of https://github.com/pavel-odintsov/fastnetmon synced 2024-11-24 02:46:36 +01:00
fastnetmon-rewritten/docs/MONGODB.md
2015-07-15 00:33:11 +03:00

1.1 KiB

This article describes everything about ongoing MongoDB integration

Sorry, we haven't integration for it now but we will finish this work sometimes :)

Debian 8 Jessie.

Install MongoDB itself:

apt-get install -y mongodb-server mongodb-clients mongodb-dev  

Library compilation:

cd /usr/src
wget https://github.com/mongodb/mongo-c-driver/releases/download/1.1.9/mongo-c-driver-1.1.9.tar.gz
tar xzf mongo-c-driver-1.1.9.tar.gz
cd mongo-c-driver-1.1.9
./configure --prefix=/opt/mongo_c_driver
make
make install
echo /opt/mongo_c_driver/lib > /etc/ld.so.conf.d/mongodb_c_driver.conf
ldconfig

Build test example:

g++ mongodb_client.cpp $(PKG_CONFIG_PATH=/opt/mongo_c_driver/lib/pkgconfig pkg-config --cflags --libs libmongoc-1.0)

Query test data:

> use test
switched to db test
> show collections
system.indexes
test
> db.test.find()
{ "_id" : ObjectId("55a57b77d6db1e6ab778b4f1"), "hello" : "world" }
{ "_id" : ObjectId("55a57cf5d6db1e6ae37dc6b1"), "hello" : "world" }
{ "_id" : ObjectId("55a57d95d6db1e6afa70ca41"), "hello" : "world" }