当前位置:Gxlcms > 数据库问题 > MongoDB使用

MongoDB使用

时间:2021-07-01 10:21:17 帮助过:6人阅读

#coding:utf-8
#! /usr/bin/python
‘‘‘
Author fiz
Date:2016-03-30 
‘‘‘
import pymongo
client = pymongo.MongoClient()
db = client.test_db
collection = db.test_collection

mydict = {‘name‘:‘Lucy‘, ‘sex‘:‘female‘,‘job‘:‘nurse‘}
mylist = []
mylist.append(mydict)
collection.insert_many(mylist)
for i in collection.find({‘name‘:‘Lucy‘}):
    print i

  

MongoDB使用

标签:

人气教程排行