草庐IT

query_index

全部标签

indexing - MongoDB - 当嵌入键是 URI 时索引嵌入键

当我为嵌入式文档编制索引时,我无法让MongoDB中的索引正常工作。如果内部键是一个简单的字符串,索引就可以正常工作,但由于我的数据格式,内部键通常需要是URI,这似乎不起作用,当我尝试创建索引时查看Mongo日志,它说索引已创建,但它会将每个文档添加到索引中。这种类型的属性名称上的索引不起作用的原因是什么?我该怎么做才能避免这个问题?示例文档{name:"some-name",graph:{"http://example.org/subject":{"http://example.org/predicate":[{"value":"http://example.org/object"

php - Doctrine ODM/MongoDB : in AND in queries

我正在将DoctrineODM与mongoDB结合使用。我正在尝试执行如下查询:$queryBuilder->field('array_field')->in('even_value_1','event_value_2');$queryBuilder->field('array_field')->in('odd_value_1','odd_value_2');这个想法是选择所有在他们的文档中array_field(event_value_1ORevent_value_2)AND(odd_value_1ORodd_value_2)使用我正在使用的语法,我得到的文档有event_value

ruby - Mongo ruby 驱动程序 : Running/getting mongostats/query Graphs

我正在使用mongo-ruby-driver,我想获取统计/查询图表以显示Mongo。但是不知道如何通过mongo-ruby-driver获取Mongostats/Graphs。非常感谢任何帮助。 最佳答案 您可以setupMMS而不是自己的权利并改用它。但是,如果您确实想直接提取数据,您也可以这样做——任何可以从shell运行的东西都可以从驱动程序运行。因此,例如,运行stats()命令,该命令在命令行上转换为:db.runCommand({dbstats:1})因此,只需遵循rubydriverFAQ顶部的指南即可-第一个包括如

mongodb - 断言 10320 BSONElement : bad type 113 when querying profile collection, db.system.profile.find()

我在ec2中运行Mongo2.2.1,我启用了分析功能,并且每180秒向Graphite发送一个缓慢的操作摘要。脚本时不时地报告错误(BSONElement:错误类型113),如果我登录到Mongoshell并运行db.system.profile.find(),我会得到更详细的报告:MonFeb1809:12:48Assertion:10320:BSONElement:badtype1130x6073f10x5d1aa90x4b0d980x5c17a60x6b3f350x6b6a2c0x69be0a0x6aa13f0x668e460x668ec20x66a2ce0x5cbcc40x4

mongodb - 如何在不覆盖接口(interface)中带注释的@Query 方法的情况下自定义 MongoRepository?

我想通过添加一个方法来自定义MongoRepository,并且仍然使用MongoRepository提供的已实现方法。下面是代码:publicinterfaceTopoRepositoryInterfaceextendsMongoRepository{@Query("{'name':?0}")publicTopofindByName(Stringname);publiclonggetPublishedTopoCount();}实现声明是:publicclassTopoRepositoryImplextendsSimpleMongoRepositoryimplementsTopoRep

ruby-on-rails - Ruby on Rails Mongoid 和 Webfaction : Not Authorized For Query (Error 16550)

我使用的是2.4.4版,遵循http://docs.webfaction.com/software/mongodb.html中的程序并在RubyonRails中使用Mongoid。我还在使用“userAdminAnyDatabase”权限的数据库中创建了一个用户,并将其与此railsmongoid配置一起使用:production:sessions:default:database:hosts:-localhost:username:password:我让服务器使用--auth标志运行,我还尝试使用mongodbcpmmand行的用户,它可以工作,但是部署了我的Rails应用程序后,我

mongodb - 我们是否需要删除名为 system.indexes 的集合以使新索引应用于该集合

我对MongoDB中的索引有疑问。我使用的是MongoDB1.6.5版。我正在修改我所有的收藏索引。当我在我的MongoDBshell中使用showcollections命令时,它显示了我的一个集合system.indexesstocksoptions我是否需要删除集合system.indexes才能应用集合上的新索引? 最佳答案 然而system.profile集合不在那里,不,你没有。profile集合是分析器的输出,仅此而已。索引仍然适用。编辑由于您的问题说明了两件事,所以您也不需要删除system.indexes,Mongo

java - Spring 数据 MongoDB : Query by class instance

我有一个SpringDataMongoDB存储库,我想使用定义为对象的搜索条件进行查询。详细信息:我有一个模型类:@DocumentpublicclassModelClass{@IdprivateStringid;privateStringfield1;privateStringfield2;...privateStringfield10;//gettersandsetters}我还有一个MongoRepository来存储此类的实例:publicinterfaceRepoextendsMongoRepository{}我想使用ModelClass的实例作为搜索条件来查询存储库。此类实

MongoDb 2.6.1 错误 : 17444 - "Legacy point is out of bounds for spherical query"

在我的系统中将MongoDb升级到2.6.1后,有时会出现以下错误:Legacypointisoutofboundsforsphericalquery错误代码17444此处:https://github.com/mongodb/mongo/blob/master/src/mongo/db/geo/geoquery.cpp#L73我可以看到这是由于某些无效数据而由mongodb引发的。//Theuser-providedpointcanbeflat.Weneedtomakesurethatit'sinbounds.if(isNearSphere){uassert(17444,"Legac

Python mongodb create_index 错误

我收到这个错误:错误:cache_for必须是整数或float。那是因为这一行:self.db.table_name.create_index("url",{"unique":True})但我不知道为什么,这里有什么问题? 最佳答案 你做错了正确的语法是:self.db.table_name.create_index("url",unique=True)默认情况下,这会创建一个单键升序索引,等同于self.db.table_name.create_index([("url",pymongo.ASCENDING)],unique=Tr