查找集合中的首个文档

  1. import pymongo
  2.  
  3. myclient = pymongo.MongoClient("mongodb://localhost:27017/")
  4. mydb = myclient["mydatabase"]
  5. mycol = mydb["customers"]
  6.  
  7. x mycol.find_one()
  8.  
  9. print(x)