From 94db2cfa4bea19c7bc30cf962730fcdaf819af6c Mon Sep 17 00:00:00 2001
From: Martin Bauer <martin.bauer@fau.de>
Date: Fri, 25 Aug 2017 14:36:21 +0200
Subject: [PATCH] ParameterStudy database: mongodb backend

---
 runhelper/db.py | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/runhelper/db.py b/runhelper/db.py
index 13faa2320..5ef5d7cfd 100644
--- a/runhelper/db.py
+++ b/runhelper/db.py
@@ -41,7 +41,14 @@ class Database(object):
         pass
 
     def __init__(self, file):
-        self.backend = blitzdb.FileBackend(file)
+        if file.startswith("mongo://"):
+            from pymongo import MongoClient
+            dbName = file[len("mongo://"):]
+            c = MongoClient()
+            self.backend = blitzdb.MongoBackend(c[dbName])
+        else:
+            self.backend = blitzdb.FileBackend(file)
+
         self.backend.autocommit = True
 
     @staticmethod
-- 
GitLab