随笔分类 -  mongodb

摘要:批量更新 db.test.updateMany({name:'test'},{$set:{value:1}}) 单更新 db.test.update({name:'test'},{$set:{value:1}}) 删除列 > db.test.update({name:'test'},{$unset: 阅读全文
posted @ 2016-12-21 10:29 無限大 阅读(224) 评论(0) 推荐(0)
摘要:2.x index,writeConcern, readPreference 3.0 wiredtiger, pluggable staorage engine, improved mmapv1 3.2 Raft协议 , 文档检验, 部分索引 , inMemory, $lookup 3.4 并行复制 阅读全文
posted @ 2016-12-16 13:41 無限大 阅读(490) 评论(0) 推荐(0)
摘要:原因:mongodb每一个文档默认只有16M。聚合的结果是一个BSON文档,当超过16M大小时,就会报内存不够错误。 exceeded memory limit for $group.but didn't allow external sort. 可以采用打开使用磁盘来解决大小问题。例如 db.fl 阅读全文
posted @ 2016-11-04 16:06 無限大 阅读(6237) 评论(1) 推荐(2)
摘要:在包含url的test库中运行test.js mongo url:port/test test.js 阅读全文
posted @ 2016-11-03 11:09 無限大 阅读(525) 评论(0) 推荐(0)
摘要:先安装python pip。一种python包管理工具。 下面这篇文章讲的很详细。亲测可行。 https://ruter.github.io/2015/12/03/Update-python/ github的mtool安装方法 https://github.com/rueckstiess/mtool 阅读全文
posted @ 2016-10-08 13:44 無限大 阅读(1984) 评论(0) 推荐(0)
摘要:benchrun mongostat mongo bin中自带的一个工具。 db.serverStatus() mongo推荐使用xfs文件系统会对性能有很大提升。(ext4自带loc,并发性能会下降。有时候会导致系统时快时慢) mongo最好能够有独立硬盘。 阅读全文
posted @ 2016-09-23 09:21 無限大 阅读(527) 评论(0) 推荐(0)
摘要:聚合语句-比较集合内两字段大小 db.test.aggregate([{$match:{"offlineTime":{$gt:ISODate("2016-09-13T01:54:55Z"), "$lt":ISODate("2016-09-13T10:05:55Z")},"logType":"off" 阅读全文
posted @ 2016-09-18 13:55 無限大 阅读(530) 评论(0) 推荐(0)
摘要:参考原文:http://www.mongoing.com/eshu_explain3 理想的查询状态由以下两种 普通查询: nReturned=totalKeysExamined & totalDocsExamined=0 (cover index,仅仅使用到了index,无需文档扫描,这是最理想状 阅读全文
posted @ 2016-09-07 15:56 無限大 阅读(652) 评论(0) 推荐(0)
摘要:翻阅数据是MongoDB最常见的操作之一。一个典型的场景是需要在你的用户界面中显示你的结果。如果你是批量处理的数据,同样重要的是要让你的分页策略正确,以便你的数据处理可以规模化。 接下来,让我们通过一个例子来看在MongoDB中翻阅数据的不同方式。在这个例子中,我们有一个CRM数据库的用户数据,我们 阅读全文
posted @ 2016-07-06 10:48 無限大 阅读(288) 评论(0) 推荐(0)
摘要:-- 测试数据 db.childTests.insert({ "_id" : 1, "item" : "ABC", "sizes": [ {age: 10, name:"susan"}, {age:11, name:"sandy"}] })db.childTests.insert({ "_id" : 阅读全文
posted @ 2016-06-23 20:28 無限大 阅读(2166) 评论(0) 推荐(0)
摘要:导出例子: mongoexport -d test -c test -q '{sn:1}' -o test.dat 导入例子: mongoimport -d test -c students students.dat 导出excel: mongoexport -d test -c user -q { 阅读全文
posted @ 2016-05-26 11:02 無限大 阅读(183) 评论(0) 推荐(0)
摘要:使用gradle。 查找最新版本http://mvnrepository.org/ 配置spring 配置resource xml 执行js 生成之后会在mongo数据库中生成一个mongogeez表管理已经执行过的表 阅读全文
posted @ 2016-05-06 19:24 無限大 阅读(699) 评论(0) 推荐(0)
摘要:1.group by并且计算总数 2.Crieria的使用,注意andOperator和orOperator的用法 Aggregation agg = Aggregation.newAggregation( Aggregation.match(new Criteria() .andOperator( 阅读全文
posted @ 2016-03-24 16:05 無限大 阅读(9276) 评论(0) 推荐(0)
摘要:<bean id="defaultMongoTypeMapper" class="org.springframework.data.mongodb.core.convert.DefaultMongoTypeMapper"> <constructor-arg name="typeKey"> <null 阅读全文
posted @ 2016-03-09 18:01 無限大 阅读(5497) 评论(0) 推荐(0)
摘要:1.在无密码模式下添加账号 2.角色权限说明 http://www.2cto.com/database/201507/420854.html 阅读全文
posted @ 2016-03-08 10:17 無限大 阅读(157) 评论(0) 推荐(0)
摘要:windows版本 http://dl.mongodb.org/dl/win32/x86_64 安装教程 https://docs.mongodb.org/manual/tutorial/install-mongodb-on-windows/ mac os 版本 https://docs.mongo 阅读全文
posted @ 2016-03-01 10:41 無限大 阅读(154) 评论(0) 推荐(0)