Reputation: 1
This is the below code:
import sys
from pymongo import MongoClient
import json
def main ():
# Connection to the MongoDB Server
mongoClient = MongoClient ('localhost:27017')
# Connection to the database
db = mongoClient.Botdata
Botdata = db.Botdata
collection = db.intent
details = collection.find ({"intents": "patterns"})
#docs = list(Botdata.find({'intents': 'tag'}))
print(details)
if __name__ == "__main__":
main ()
The main issue is whenever I run this code I get this type of error:
<pymongo.cursor.Cursor object at 0x7f31623955f8>
The thing is I have stored the data in mongodb but while retrieving the same data this code is showing this error please help.
Upvotes: 0
Views: 277
Reputation: 11
You are getting a cursor object just iterate over it. you will find the relevant records.
details = collection.find ({"intents": "patterns"})
for data in details:
print(data)
Upvotes: 1