0

I am receiving an output like [<ColletionName: ColletionName object>]. But when I try using json dumps and loads as shown below, it returns only the heading of the table and not along with the body.

   return loads(dumps(cursor))

This returns only the table headers and not along with the value. How to get the complete values in JSON format from cursor list using python/pymongo?

2 Answers 2

1

Convert the cursor to a list:

return loads(dumps(list(cursor)))
Sign up to request clarification or add additional context in comments.

2 Comments

This too returns only the headers in a list
How is cursor created?
0

Just use a for loop.

for i in cursor_list:
    print i.id (the header)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.