스테이징 데이터베이스로 내 pymongo와 간단한 작업을하려고합니다. 이제 보통FIND 메소드가 pymongo 또는 VERSION에 없습니까?
import pymongo
connection = pymongo.Connection(host = 'mongodb://username:[email protected]:37017,/dbname?safe=true&slaveOk=true&fsync=true&journal=true&ssl=true')
그냥
connection.find({})
> Traceback (most recent call last):
File "D:\MypythonCode\test.py", line 7, in <module>
connection.find({})
File "C:\Python27\lib\site-packages\pymongo\database.py", line 769, in __call_
_
self.__name, self.__connection.__class__.__name__))
TypeError: 'Database' object is not callable. If you meant to call the 'find' me
thod on a 'Connection' object it is failing because no such method exists.
C:\Python27>python.exe D:\MypythonCode\test.py > test.d
Traceback (most recent call last):
File "D:\MypythonCode\test.py", line 7, in <module>
connection.find({})
File "C:\Python27\lib\site-packages\pymongo\database.py", line 769, in __call_
_
self.__name, self.__connection.__class__.__name__))
TypeError: 'Database' object is not callable. If you meant to call the 'find' me
thod on a 'Connection' object it is failing because no such method exists.
또는 버전을 확인하기 위해 제일 먼저!?
connection.version()
Traceback (most recent call last):
File "test.py", line 7, in <module>
connection.version()
File "C:\Python27\lib\site-packages\pymongo\database.py", line 769, in __call_
_
self.__name, self.__connection.__class__.__name__))
TypeError: 'Database' object is not callable. If you meant to call the 'version'
method on a 'Connection' object it is failing because no such method exists.
Press any key to continue . . .
-1 생각하지 않아도됩니다. 컬렉션이 아닌 연결 객체에서 find()를 호출하고 있습니다. 연결이 find()를 구현해야하는 이유는 무엇입니까? find()는 콜렉션의 기능입니다. 제발 RTFM –
당신은 옳았어요! 나는 연결을 묻고 있었다! 자유롭게 질문을 삭제하십시오! – user702846