DSP2017: MongoDB installation

by Marius at 11-03-2017

Introduction to MongoDB

In order to start development of a given product or application one must first configure a proper environment.

As MongoDB documentation states it is an open-source document database, which provides high performance, availability and scalling. In this project those features are not so important because number of documents will be rather small.

I chose MongoDB because of a nature of stored objects, all posts are documents with additional fields. In MongoDB a record is simply an document, which contains pairs of field name and value. Those documents are very similar to JSON objects or Python dicts. Objects in MongoDB needs to have unique ID, which is sort of primary key.


I use OpenSuse Tumbleweed as a dev platform, so the first step was to install MongoDB. Unfortunately there was not MongoDB in standard repositories, so first step was to add new repos:

zypper addrepo http://download.opensuse.org/repositories/server:database/openSUSE_Tumbleweed/server:database.repo
zypper refresh

Next I simply installed it with

zypper install mongodb

Then it was time to test server, so I opened IPython client and typed:

In [1]: from pymongo import MongoClient

In [2]: client = MongoClient()

In [3]: db = client.primer

In [4]: db.dataset
Out[4]: Collection(Database(MongoClient(host=['localhost:27017'],
document_class=dict, tz_aware=False, connect=True), u'primer'), u'dataset')

It seems that MongoDB server works without any further configuration.


During last week I installed MongoDB and added skeleton for checker service.