print to console from pyCharm isnt working. Need help

63 views
Skip to first unread message

Zachary Devore

unread,
Aug 28, 2015, 10:59:16 PM8/28/15
to mongodb-user
I have written the basic script below but cant get the output to write to the console to save my life. I had it working before and cant get it working again. Could really use help. I am typically a hadoop user, and am new to both mongo and phython. Really appreciate any help. Output from console also stored below.

import pymongo

from pymongo import MongoClient
client = MongoClient()

client = MongoClient('localhost',27017)

db = client.testdb

reqs = db.testdb

query = reqs.find()
print(query)



C:\Python34\python.exe C:/Users/devorezr/PycharmProjects/resume_parser/src/testQuery.py
<pymongo.cursor.Cursor object at 0x033F07B0>

Process finished with exit code 0

Tim Hawkins

unread,
Aug 30, 2015, 6:56:03 PM8/30/15
to mongodb-user

Your script appears to be printing exactly what you asked it to do. The find command returns a pymongo cursor object, which is what you are seeing printed.

If you want to see the objects that the cursor references, then you will need to itterate it and print each object.


--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.
 
For other MongoDB technical support options, see: http://www.mongodb.org/about/support/.
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user...@googlegroups.com.
To post to this group, send email to mongod...@googlegroups.com.
Visit this group at http://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/db05d7c7-ab4e-48da-be1f-af9d159aa725%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages