From charlesreid1

Covering some notes on MongoDB for the UGR wifi project.

MongoDB goals:

  • Get it set up and working locally with a test database script
    • Add records
    • Drop records
    • Query records - for all records within a date range, for all records matching a mac address, for all clients on a certain network, for all macs matching a certain prefix pattern
  • Get MongoDB working over stunnel
  • Get MongoDB set up in a docker container with a persistent data storage volume

Use the already-finished instructions here:

Also use the PyMODM library:

Installing

Mac

On a Mac, to test things out:

brew install mongodb --with-openssl
pip install pymodm

Ubuntu

On Ubuntu, the eventual server platform:

apt-get install mongodb
apt-get install python-pip.    # may be necessary
pip install pymodm

Configuration File

On a Mac, the configuration file should be located in /usr/local/etc/mongod.conf.

On Unbuntu, the config file should be in /etc/mongod.conf.

Here are the contents of the default configuration file:

mongod.conf (default)

systemLog:
  destination: file
  path: /usr/local/var/log/mongodb/mongo.log
  logAppend: true
storage:
  dbPath: /usr/local/var/mongodb
net:
  bindIp: 127.0.0.1

...

Starting with Specified Configuration File

To start with a specified config file, use the -f flag:

mongod -f /usr/local/etc/mongod.conf