随笔 - 547  文章 - 213 评论 - 417 阅读 - 107万

随笔分类 -  mangodb

1 2 下一页
Mongodb: Sort operation used more than the maximum 33554432 bytes of RAM
摘要:上线许久的产品突然爆出了一个Mongodb 查询的BUG,错误如下: 原因比较明确:Sort operation used more than the maximum 33554432 bytes of RAM.,33554432 bytes算下来正好是32Mb,而Mongodb的sort操作是把数 阅读全文
posted @ 2018-08-06 10:51 今夜太冷 阅读(781) 评论(0) 推荐(0) 编辑
Data type conversion in MongoDB
摘要:[问题] I have a collection called Document in MongoDB. Documents in this collection have a field called CreationDate stored in ISO date type. My task is 阅读全文
posted @ 2018-07-18 13:37 今夜太冷 阅读(303) 评论(0) 推荐(0) 编辑
Project with Match in aggregate not working in mongodb
摘要:[问题] 2down votefavorite I am trying to fetch data based on some match condition. First I've tried this: Here ending_date is full date format Offer.agg 阅读全文
posted @ 2018-07-18 13:35 今夜太冷 阅读(325) 评论(0) 推荐(0) 编辑
MongoDB: 如何删除一个collection中的一个字段?
摘要:Try this: If your collection was 'example' db.example.update({}, {$unset: {words:1}}, false, true); Refer this: http://www.mongodb.org/display/DOCS/Updating#Updating-%24unset UPDATE: The above ... 阅读全文
posted @ 2018-02-06 10:47 今夜太冷 阅读(1121) 评论(0) 推荐(0) 编辑
Mongo = get size of single document
摘要:Object.bsonsize(db.test.findOne({type:"auto"})) 阅读全文
posted @ 2018-01-31 09:45 今夜太冷 阅读(181) 评论(0) 推荐(0) 编辑
How to duplicate the records in a MongoDB collection
摘要:// Fill out a literal array of collections you want to duplicate the records in. // Iterate over each collection using the forEach method on the array. // For each collection get (find) all the reco... 阅读全文
posted @ 2018-01-26 10:57 今夜太冷 阅读(193) 评论(0) 推荐(0) 编辑
Create root user on MongoDB
摘要:db.createUser( { user: "user", pwd: "pass", roles: [ "root" ] }); use database;db.createUser( { user: "user", pwd: "pass", roles: [ { role: "readWrite", db: "database" }... 阅读全文
posted @ 2018-01-25 16:43 今夜太冷 阅读(194) 评论(0) 推荐(0) 编辑
mongodb最大连接数、最大连接数修改
摘要:mongodb最大连接数是20000。 所以业界流传一段话,千万级以下的用mysql、千万级以上的用mongodb,亿级以上的用hadoop。 查看mongodb最大连接数 mongodb/bin/mongo >db.serviceStatus().connections; current数值+available数值就是当前mongodb最大连接数 修改mongodb最大连接数 在... 阅读全文
posted @ 2018-01-25 16:08 今夜太冷 阅读(6460) 评论(0) 推荐(0) 编辑
如何实现json字符串和 BsonDocument的互相转换
摘要:String to BsonDocument string json = "{ 'foo' : 'bar' }"; MongoDB.Bson.BsonDocument document = MongoDB.Bson.Serialization.BsonSerializer.Deserialize(json); BsonDocument to json string. BsonDocume... 阅读全文
posted @ 2018-01-24 17:06 今夜太冷 阅读(13052) 评论(0) 推荐(3) 编辑
MonoDB的数据准备
摘要:首先是数据的录入,为了分析我们服务器集群的性能,需要准备大量的用户数据,幸运的是mtools提供了mgenerate方法供我们使用。他可以根据一个数据模版向 MongoDB 中插入任意条 json 数据。下面的 json 结构是我们在例子中需要使用的数据模版: { "user": { "name": { "first": {"$choose": ["Liam", "Aubre... 阅读全文
posted @ 2018-01-24 15:34 今夜太冷 阅读(482) 评论(0) 推荐(0) 编辑
Mongo DB Sharding
摘要:Database Sharding is considered to be the horizontal partitioning of a database or the search engine where each partition is called as a Shard. This is a process of compressing the data collections by... 阅读全文
posted @ 2018-01-23 13:40 今夜太冷 阅读(143) 评论(0) 推荐(0) 编辑
MongoDB server side Javascript 如何直接传入字符串?
摘要:MongoDB server side Javascript的介绍如下: https://docs.mongodb.com/v3.0/core/server-side-javascript/#running-js-files-via-a-mongo-shell-instance-on-the-server 根据文档描述,可以直接传入一个Javascript对象来做查询,比如: db.adminC... 阅读全文
posted @ 2018-01-18 13:41 今夜太冷 阅读(239) 评论(0) 推荐(0) 编辑
Is there anyway to discover which ip addresses are connected to the db?
摘要:From mongo shell run db.currentOp() to show all active connections or db.currentOp(true) to show all connections. From: https://stackoverflow.com/questions/9945107/is-there-anyway-to-discover-which-... 阅读全文
posted @ 2017-11-16 16:23 今夜太冷 阅读(169) 评论(0) 推荐(0) 编辑
mongodb自动关闭:页面文件太小,无法完成操作
摘要:在一台两G内存的win server 2008电脑上运行一个程序,一段时间后mongod自动停止,发现日志文件最后有这样的错误: 2014-11-30T00:32:32.914+0800 [conn30751] command taskdb.$cmd command: count { count: 阅读全文
posted @ 2017-08-26 11:35 今夜太冷 阅读(1279) 评论(0) 推荐(0) 编辑
Mongo如何在多个字段中查询某个关键字?
摘要:If a text index has multiple fields in Mongo, how can I do a search in only one field since the weight is applied to the index and not to the query? 1 Answer I assume you are using MongoDB version... 阅读全文
posted @ 2017-06-21 13:41 今夜太冷 阅读(2230) 评论(0) 推荐(0) 编辑
mongodb自动关闭:页面文件太小,无法完成操作
摘要:上次在一台两G内存的win server 2008电脑上运行一个程序,一段时间后mongod自动停止,发现日志文件最后有这样的错误: 2014-11-30T00:32:32.914+0800 [conn30751] command taskdb.$cmd command: count { count 阅读全文
posted @ 2017-02-18 20:56 今夜太冷 阅读(1141) 评论(0) 推荐(0) 编辑
mongo文本搜索的一个例子
摘要:假如有一个名为articles的集合,数据如下: { "_id" : 1, "title" : "cakes and ale" } { "_id" : 2, "title" : ... 阅读全文
posted @ 2016-05-27 11:35 今夜太冷 阅读(240) 评论(0) 推荐(0) 编辑
Mongo命令批量更新某一数组字段的顺序
摘要:db.table.find().forEach(function (doc) { var oldValue = doc.Column1; var newValue = [sa[1],sa[0],sa[2]]; db.table.update({_id: doc._id}, { $set: { Column1: newValue } }); }) 阅读全文
posted @ 2016-05-13 16:08 今夜太冷 阅读(1497) 评论(0) 推荐(0) 编辑
Mongo的安全验证
摘要:参考如下的文档: https://docs.mongodb.org/manual/tutorial/enable-authentication/ 1.1. 在启用匿名验证的情况下,创建一个可以管理所有数据库用户的用户。 use admin db.createUser( { user: "admin" 阅读全文
posted @ 2016-03-24 17:13 今夜太冷 阅读(474) 评论(0) 推荐(0) 编辑
Mongo读书笔记2 -- 数据类型
摘要:Mongo有多种类型的collection, 默认的是随着document 数目的增多自动增大; 还有一些collection被称为capped collection, 只能包含固定数目的document, 当向里面添加document时, 最老的文档就会被新加的文档替换。 每个mongo collection都有唯一的名字,名字可以包含数字,letter和下划线,但$符不能用,是mongo保... 阅读全文
posted @ 2016-03-02 15:43 今夜太冷 阅读(403) 评论(0) 推荐(0) 编辑

1 2 下一页
点击右上角即可分享
微信分享提示