增加MongoDB数据插入时,因为没有连接,失败后的日志提示

This commit is contained in:
chenxy123 2017-01-05 22:31:42 +08:00
parent ac190f5162
commit 304c6a9fdb

View File

@ -256,6 +256,8 @@ class MainEngine(object):
db = self.dbClient[dbName]
collection = db[collectionName]
collection.insert_one(d)
else:
self.writeLog(u'数据插入失败MongoDB没有连接')
#----------------------------------------------------------------------
def dbQuery(self, dbName, collectionName, d):
@ -266,6 +268,7 @@ class MainEngine(object):
cursor = collection.find(d)
return list(cursor)
else:
self.writeLog(u'数据查询失败MongoDB没有连接')
return []
#----------------------------------------------------------------------
@ -275,6 +278,8 @@ class MainEngine(object):
db = self.dbClient[dbName]
collection = db[collectionName]
collection.replace_one(flt, d, upsert)
else:
self.writeLog(u'数据更新失败MongoDB没有连接')
#----------------------------------------------------------------------
def getContract(self, vtSymbol):