摘要: BSON是由10gen开发的一个数据格式,目前主要用于MongoDB中,是MongoDB的数据存储格式。BSON基于JSON格式,选择JSON进行改造的原因主要是JSON的通用性及JSON的schemaless的特性。 BSON主要会实现以下三点目标: 1.更快的遍历速度 对JSON格式来说,太大的 阅读全文
posted @ 2017-09-20 20:56 追梦的独行者 阅读(202) 评论(0) 推荐(0) 编辑
摘要: python直接连接mongo数据库 def __init__(self): self.client = MongoClient() self.db=self.client['blog'] python通过MongoEngine链接数据库 import mongoengine from mongoe 阅读全文
posted @ 2017-09-20 17:17 追梦的独行者 阅读(184) 评论(0) 推荐(0) 编辑
摘要: 参考文档链接:https://pypi.python.org/pypi/pymongo pymongo的参考文档http://api.mongodb.com/python/current/tutorial.html mongoengine的参考文档:https://pypi.python.org/p 阅读全文
posted @ 2017-09-20 17:07 追梦的独行者 阅读(155) 评论(0) 推荐(0) 编辑
摘要: 创建一个学生信息表(至少包含:姓名,性别,成绩,年龄) 1、写入十五条不同的数据 db.students.insertMany([{ name: "bob", age: 16, sex: "male", grade: 95},{ name: "ahn", age: 18, sex: "female" 阅读全文
posted @ 2017-09-20 16:37 追梦的独行者 阅读(739) 评论(0) 推荐(0) 编辑
摘要: 转自:http://www.mongoing.com/docs/tutorial/remove-documents.html 删除的方法 MongoDB provides the following methods to delete documents of a collection: db.co 阅读全文
posted @ 2017-09-20 16:29 追梦的独行者 阅读(4491) 评论(0) 推荐(0) 编辑
摘要: 转自:http://www.mongoing.com/docs/tutorial/update-documents.html 更新 MongoDB提供如下方法更新集合中的文档: db.collection.updateOne() 即使可能有多个文档通过过滤条件匹配到,但是也最多也只更新一个文档。 3 阅读全文
posted @ 2017-09-20 16:27 追梦的独行者 阅读(2825) 评论(0) 推荐(0) 编辑
摘要: 转自:http://www.mongoing.com/docs/tutorial/insert-documents.html 插入方法 MongoDB提供了如下方法向集合插入 文档 documents : db.collection.insertOne() db.collection.insertM 阅读全文
posted @ 2017-09-20 16:25 追梦的独行者 阅读(6164) 评论(0) 推荐(0) 编辑
摘要: 转自:http://www.mongoing.com/docs/tutorial/query-documents.html 查询方法 MongoDB 提供了 db.collection.find() 方法从集合中读取文档。db.collection.find() 方法返回指向匹配文档的:doc:cu 阅读全文
posted @ 2017-09-20 16:23 追梦的独行者 阅读(772) 评论(0) 推荐(0) 编辑