Im have some data from my collection at mongoDb i want to see all data from specified collection let say i've simple code like this
from pymongo import MongoClient
url = 'my url'
client = MongoClient(url, ssl=True, retryWrites=True)
class DB(object):
def __init__(self):
self.db = client.mydb
self.col = self.db.mycol
def see_listed(self):
for i in self.col.find():
return i
db = DB()
print(db.see_listed())
That only returned one data from my collection
but if i changed code from see_listed to
for i in self.col.find():
print(i)
That return all of data from my collection,where my wrong i don't know.. I just read some documents at try like this.
Im so thankful for any help im appreciate