草庐IT

index-async

全部标签

indexing - 如何在生产中有效地建立 "defragment"MongoDB 索引?

我一直在研究MongoDB。感觉不错。我在集合中添加了一些索引,上传了一堆数据,然后删除了所有数据,我注意到索引没有改变大小,类似于报告的行为here.如果我打电话db.repairDatabase()然后索引被压缩到接近于零。同样,如果我不删除所有数据,而是调用repairDatabase(),索引会稍微压缩(可能是因为未使用的扩展被截断了?)。我从db.collection.stats()的“totalIndexSize”获取索引大小。但是,这需要很长时间(我读到在大型数据库上可能需要数小时)。我不清楚数据库在运行时读取或写入的可用性如何。我猜不太可用。由于我想运行尽可能少的mon

javascript - meteor js : Create text index in collection

我创建了一个带有名称和描述字段的类别集合。即Categories=newMeteor.Collection('categories');CategoriesSchema=newSimpleSchema({translation:{type:[Object]},"translation.$":{type:Object},"translation.$.name":{type:String},"translation.$.description":{type:String}});Categories.attachSchema(CategoriesSchema);我需要创建一个文本索引来按名称

node.js - 错误 : connect EADDRNOTAVAIL while processing big async loop

我遇到了一个非常奇怪的问题。我正在导入一些大的xml文件并将它们存储到mongoDB中。该算法是一个典型的异步循环:doLoop=function(it,callback_loop){if(it现在(代码突然没有任何显着变化)在执行循环时出现以下错误:events.js:72thrower;//Unhandled'error'event^Error:connectEADDRNOTAVAILaterrnoException(net.js:901:11)atconnect(net.js:764:19)atnet.js:842:9atdns.js:72:18atprocess._tickCa

MongoDB ODM 索引 : How to Index multiple Compound index on a documnt that have EmbeddedDocument in itself?

我有这个类(class):/***@ODM\Document*@Indexes({*@Index(keys={"status"="asc","regDate"="desc","expDate"="asc","isFeatured"="asc"}),*@Index(keys={"status"="asc","visits.total"="asc","visists.today"="asc"}),*@Index(keys={"status"="asc","price.value"="asc","regDate"="asc"})*})*/classProduct{/***@ODM\Date*

mongodb - MongoError : can't find any special indices: 2d (needs index), 2dsphere(需要索引)

我正在尝试通过使用MongoDB的查找方法查询特定点周围的纬度和经度点来使用MongoDB的地理空间索引。我不断收到错误消息:MongoError:can'tfindanyspecialindices:2d(needsindex),2dsphere(needsindex)在谷歌搜索了大约一个小时后,我不确定文档在哪里。我也找不到任何好的解释。这是我使用Mongoose创建的架构:varmongoose=require('mongoose');varSchema=mongoose.Schema;varEventSchema=newSchema({name:String,descripti

Mongodb - 多文本索引 : Index key pattern too large error code 67

我有以下Mongodb数据库结构:{"_id":"519817e508a16b447c00020e","keyword":"Justanexamplequery","rankings":{results:{"1":{"domain":"example1.com","href":"http://www.example1.com/"},"2":{"domain":"example2.com","href":"http://www.example2.com/"},"3":{"domain":"example3.com","href":"http://www.example3.com/"},"

MongoDB : multiple specific collections or one "store-it-all" collection for performance/indexing

我正在记录用户在我们网站上进行的不同操作。每个Action都可以是不同的类型:评论、搜索查询、页面View、投票等……这些类型中的每一个都有自己的模式和公共(public)信息。例如:comment:{"_id":(mongoId),"type":"comment","date":4/7/2012,"user":"Franck","text":"Thisisasamplecomment"}search:{"_id":(mongoId),"type":"search","date":4/6/2012,"user":"Franck","query":"mongodb"}etc...基本上,

node.js - Node.js async eachLimit 在这种情况下如何工作?

我写了一点async用于将大量JSON文件批量插入MongoDB分片集群的脚本。这是我第一次使用此模块(我仍在学习Node.js)。我不知道我这样做对不对。代码是waterfall的最后一部分(一):前面的函数结束使用具有db、coll和files属性的对象。files数组包含数百个文件路径和函数应用到数组的每个元素也是一个waterfall(2)。waterfall(2)由以下部分组成:读取、解析、插入。当这个waterfall结束时(3)我调用complete来完成数组中单个项目的处理,并传递错误(如果有)。到目前为止一切顺利,对吗?我无法理解的是async.eachLimit回调

mongodb - sails 船 : automatically create composite unique index (mongodb)

我的SailsJS应用程序中有以下模型,我想在字段“room_name”和“school_id”上添加复合唯一键。我目前所做的是从mongo运行这个命令:db.room.ensureIndex({'room_name':1,'school_id':1},{unique:true})问题1我做得对吗?问题2是否可以修改我的模型,使其自动调用此命令而无需手动修改mongodb(从mongo命令行)?这是模型module.exports={schema:true,attributes:{room_name:{type:'string',required:true},school_id:{ty