# coding=utf-8

from pymongo import *

#获取客户端，建立连接
client = MongoClient("localhost", 27017)

#切换数据库
db = client.py3

#获取集合
stu = db.stu

#增加
#stu.insert_one({"name":"xixi"})

#修改
#stu.update_one({"name": "xixi"}, {"$set": {"name": "abc"}})

#删除
#stu.delete_one({"name": "abc"})

#查找
cursor = stu.find({"age": {"gt": 10}})
for s in cursor:
    print(s["name"])


46e3ac95ad680ba06a806c861d7c59ae259f5965
<mask token>

<mask token>
for s in cursor:
    print(s['name'])

<mask token>
client = MongoClient('localhost', 27017)
db = client.py3
stu = db.stu
cursor = stu.find({'age': {'gt': 10}})
for s in cursor:
    print(s['name'])

from pymongo import *
client = MongoClient('localhost', 27017)
db = client.py3
stu = db.stu
cursor = stu.find({'age': {'gt': 10}})
for s in cursor:
    print(s['name'])

# coding=utf-8

from pymongo import *

#获取客户端，建立连接
client = MongoClient("localhost", 27017)

#切换数据库
db = client.py3

#获取集合
stu = db.stu

#增加
#stu.insert_one({"name":"xixi"})

#修改
#stu.update_one({"name": "xixi"}, {"$set": {"name": "abc"}})

#删除
#stu.delete_one({"name": "abc"})

#查找
cursor = stu.find({"age": {"gt": 10}})
for s in cursor:
    print(s["name"])

