You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I searched in the issue and found nothing similar. | 我查找了并确认issue列表无相似报告。
Sonic version
version2.6.4
Deploy platform
agent:windows10系统
server:ubuntu系统
Minimal reproduce step
自定义python代码如下:
import pymongo
class Mongodb:
def connect_mongodb(self):
client = pymongo.MongoClient('mongodb://root:xxxx!@xxxxx:27017/?authSource=admin')
db = client.pcGlobalBase
rs = db.gmMessageEmail.find().sort({"createTime":-1}).limit(1)
for result in rs:
title = result.get("title")
code = title.split(" ")[0]
print(code)
if name == 'main':
mongoUtil = Mongodb()
result = mongoUtil.connect_mongodb()
python直接本地执行是ok的,但是用sonic的自定义代码执行就会失败:
Traceback (most recent call last):
File "D:\software\sonic-agent-v2.6.2-windows_x86_64\test-output\db2f1a7e-9452-40a8-a41b-36a0175bd9d8.py", line 16, in
result = mongoUtil.connect_mongodb()
File "D:\software\sonic-agent-v2.6.2-windows_x86_64\test-output\db2f1a7e-9452-40a8-a41b-36a0175bd9d8.py", line 8, in connect_mongodb
rs = db.gmMessageEmail.find().sort({"createTime":-1}).limit(1)
File "D:\Program Files\Python3\lib\site-packages\pymongo\cursor.py", line 873, in sort
keys = helpers._index_list(key_or_list, direction)
File "D:\Program Files\Python3\lib\site-packages\pymongo\helpers.py", line 90, in _index_list
raise TypeError("if no direction is specified, key_or_list must be an instance of list")
TypeError: if no direction is specified, key_or_list must be an instance of list
Are you willing to submit a PR?
I'm willing to submit a PR! | 我将发起PR!
The text was updated successfully, but these errors were encountered:
Search before asking
Sonic version
version2.6.4
Deploy platform
agent:windows10系统
server:ubuntu系统
Minimal reproduce step
import pymongo
class Mongodb:
def connect_mongodb(self):
if name == 'main':
mongoUtil = Mongodb()
result = mongoUtil.connect_mongodb()
Traceback (most recent call last):
File "D:\software\sonic-agent-v2.6.2-windows_x86_64\test-output\db2f1a7e-9452-40a8-a41b-36a0175bd9d8.py", line 16, in
result = mongoUtil.connect_mongodb()
File "D:\software\sonic-agent-v2.6.2-windows_x86_64\test-output\db2f1a7e-9452-40a8-a41b-36a0175bd9d8.py", line 8, in connect_mongodb
rs = db.gmMessageEmail.find().sort({"createTime":-1}).limit(1)
File "D:\Program Files\Python3\lib\site-packages\pymongo\cursor.py", line 873, in sort
keys = helpers._index_list(key_or_list, direction)
File "D:\Program Files\Python3\lib\site-packages\pymongo\helpers.py", line 90, in _index_list
raise TypeError("if no direction is specified, key_or_list must be an instance of list")
TypeError: if no direction is specified, key_or_list must be an instance of list
Are you willing to submit a PR?
The text was updated successfully, but these errors were encountered: