草庐IT

composite-index

全部标签

python - 为什么 DuplicateKeyError : E11000 duplicate key error index: test. test.$notification_1 dup key: { : null }

我像这样创建唯一索引:self.db_database[co_name].ensure_index([('src_md5',-1),('src_time',-1),('src_size',-1)],unique=True)self.db_database[co_name].ensure_index(('notification'),unique=True)self.db_database[co_name].ensure_index(('version'),unique=True)`在插入之前我创建一条记录如下:self.db_database[co_name].insert({"not

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);我需要创建一个文本索引来按名称

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...基本上,

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

Elasticsearch-10.多字段特性及配置自定义Analyzer和Index Template和Dynamic Template

Elasticsearch多字段特性及配置自定义Analyzer多字段类型ExactValuesv.sFullTextExcatvaluesV.SFullTextExactValue:包括数字/日期/具体一个字符串(例如“AppleStore”)Elasticseach中的keyword全文本,非结构化的文本数据Elasticsearch中的textExactValues不需要被分词Elasticsearch为每一个字段创建一个倒排索引ExactValue在索引时,不需要做特殊的分词处理自定义分词当Elasticsearch自带的分词器无法满足时,可以自定义分词器。通过自组合不同的组件实现.C