From 33a7826f557962d0bbb950571479ce418b192070 Mon Sep 17 00:00:00 2001 From: serhatbolsu Date: Sun, 18 Oct 2015 21:34:54 +0300 Subject: [PATCH] Update Example and Import robot Builtin library --- src/MongoDBLibrary/__init__.py | 10 +++++----- src/MongoDBLibrary/mongo_connection_manager.py | 5 ++++- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/MongoDBLibrary/__init__.py b/src/MongoDBLibrary/__init__.py index 34d88a5..8890072 100644 --- a/src/MongoDBLibrary/__init__.py +++ b/src/MongoDBLibrary/__init__.py @@ -15,12 +15,12 @@ class MongoDBLibrary(MongoConnectionManager, MongoQuery): + PyMongo 3.0.3 Documentation - http://api.mongodb.org/python/3.0.3/ - Notes: - - - Example Usage: - | # ToDo | + | Connect To MongoDB | foo.bar.org | ${27017} | + | ${QueryJSON} | Set Variable | {"name" : "username" ,"in_use": false} | + | ${UpdateJSON} | Set Variable | {"$set": {"in_use" : true}} | + | &{allResults} | Retrieve and Update One Mongodb Record | DBName | CollectionName | ${QueryJSON} | ${UpdateJSON} | + | Log | ${allResults} | """ ROBOT_LIBRARY_SCOPE = 'GLOBAL' diff --git a/src/MongoDBLibrary/mongo_connection_manager.py b/src/MongoDBLibrary/mongo_connection_manager.py index 12f8a3c..b64cc10 100644 --- a/src/MongoDBLibrary/mongo_connection_manager.py +++ b/src/MongoDBLibrary/mongo_connection_manager.py @@ -1,3 +1,4 @@ +from robot.libraries.BuiltIn import BuiltIn class MongoConnectionManager(object): @@ -10,7 +11,9 @@ def __init__(self): Initializes _dbconnection to None. """ self._dbconnection = None - + self._builtin = BuiltIn() + + def connect_to_mongodb(self, dbHost='localhost', dbPort=27017, dbMaxPoolSize=10, dbNetworkTimeout=None, dbDocClass=dict, dbTZAware=False): """