add conn init parameter so user can pass in an existing MongoDB connection
This commit is contained in:
parent
7f2619c7df
commit
d8c3df88ab
@ -171,8 +171,9 @@ class MongoDBEmitter(Emitter):
|
||||
be inserted are required parameters. The host and port are optional,
|
||||
defaulting to 'localhost' and 27017, repectively.
|
||||
"""
|
||||
def __init__(self, database, collection, host='localhost', port=27017, drop_collection=False):
|
||||
def __init__(self, database, collection, host='localhost', port=27017, drop_collection=False, conn=None):
|
||||
super(MongoDBEmitter, self).__init__()
|
||||
if not conn:
|
||||
from pymongo.connection import Connection
|
||||
conn = Connection(host, port)
|
||||
db = conn[database]
|
||||
|
Loading…
Reference in New Issue
Block a user