Table of Contents
pfmongo
is a python client/module (CLI and API) for simplifying the interaction with a MongoDB. The module provides some idiosyncratic abstractions that are nonetheless hoped to be logically straightforward. The repository includes a docker-compose.yml
that allows for easy instantiation of the MongoDB infrastructure.
If you wish to use pfmongo
on your own computer, you do need to note these prerequisites:
Since pfmongo
interacts with a MongoDB, the easiest mechanism to deploy this database is via docker-compose
and hence docker
. Installation of these is beyond the scope of this document, but should be straightforward enough. Google is your friend in that quest.
pfmongo
provides a somewhat opinionated abstraction for interacting with a MongoDB.
The best method of installing this script and all of its dependencies is by fetching it from PyPI using a python virtual environment.
pip3 install pfmongo
Alternatively, from a cloned version of the repository:
pip3 install -r requirements.txt -U ./
or for development purposes
pip3 install -r requirements.txt -e ./
Assuming you have docker and docker-compose on your system, do
docker-compose up -d
Several environment variables need to be set prior to using pfmongo
:
export MD_URI=mongodb://localhost:27017 && export MD_USERNAME=admin && export MD_PASSWORD=admin && export MD_SESSIONUSER=rudolph
$env:MD_USERNAME=admin
$env:MD_PASSWORD=admin
$env:MD_URI=mongodb://localhost:27017
$env:MD_SESSIONUER=rudolph
pfmongo --help
alias mdb='pfmongo'
mdb database connect PACSDCM
mdb collection connect MRN
mdb document add --file examples/lld.json --id lld.json
-30-