How to convert a pymongo.cursor.Cursor into a dict?

前端 未结 6 1441
日久生厌
日久生厌 2020-12-02 16:18

I am using pymongo to query for all items in a region (actually it is to query for all venues in a region on a map). I used db.command(SON()) before to search i

6条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-02 17:19

    Easy

    import pymongo
    conn = pymongo.MongoClient()
    db = conn.test #test is my database
    col = db.spam #Here spam is my collection
    array = list(col.find())
    
    print array
    

    There you go

提交回复
热议问题