MongoDB Shell:“$或”查询和解释错误()(MongoDB Shell: Error with “$or” query and explain())
我正在尝试对MongoDB“$或”查询进行一些分析,并且在Mongo shell中的'explain()'命令遇到问题。 当我使用find命令运行我的查询时,它可以正常工作并返回一条记录。 当我在find()的末尾添加'explain()'时,我收到以下错误:
未捕获的异常:错误:{“$ err”:“无效的操作符:$或”,“code”:10068}
我正在尝试以下查询:
db.people.find({"query" : {"$or" : [ {"site" : "mysite", "site_id" : "587125722"}, {"user_id" : ObjectId("4fb811aae4b0b628b485a58d")} ]}, "$orderby" : { "global_id" : 1, "user_id" : 1} })
如果我将“$或”更改为“或”,explain()可以正常工作,但查询返回0结果。 我的印象是他们的语法应该是相同的,有或没有explain(),所以我做错了什么? 我使用的是2.0.4版本。 感谢任何可能提供帮助的人。
I'm trying to do some profiling of a MongoDB "$or" query and I'm having trouble with the 'explain()' command in the Mongo shell. When I run my query with the find command, it works and returns one record, as expected. When I tack on an 'explain()' at the end of the find() however, I get the following error:
uncaught exception: error: { "$err" : "invalid operator: $or", "code" : 10068 }
I'm trying the following query:
db.people.find({"query" : {"$or" : [ {"site" : "mysite", "site_id" : "587125722"}, {"user_id" : ObjectId("4fb811aae4b0b628b485a58d")} ]}, "$orderby" : { "global_id" : 1, "user_id" : 1} })
If I change the "$or" to "or", explain() works fine, but the query returns 0 results. I was under the impression that they syntax should be the same with or without explain(), so what am I doing wrong? I'm using version 2.0.4. Thanks to anyone who may be able to help.
原文:https://stackoverflow.com/questions/11640432
最满意答案
不确定它是否真的适用于本网站,因为它不是直接编程本身...
无论如何,我使用Hosting UK进行我的虚拟主机托管,.NET 4.0和SQL 2008数据库都可用,以及中等信任环境,因此您可以在应用程序中包含其他二进制文件。
我也发现他们的支持非常好。
Not sure if it's really for this site, as it's not directly programming per se...
Anyway, I use Hosting UK for my web hosting, .NET 4.0 and SQL 2008 databases are all available, and a medium trust environment so you can include other binaries in your application.
I've also found their support to be very good.
相关问答
更多-
做数据库一般用什么软件。[2022-05-11]
sqlserver -
ASP.NET sessionState SQLServer模式超时不起作用(ASP.NET sessionState SQLServer mode timeout doesn't work)[2022-09-09]
到期时间是UTC。 当SQL会话过期时,它们不会立即从会话表中删除,也不会收到Session_End事件。 SQL会话提供程序不会主动监视会话表中的Expires列。 相反,会话在从表中删除之前不会“正式”过期,这是通过调用DeleteExpiredSessions存储过程的SQL代理作业完成的。 默认情况下,作业配置为每60秒运行一次。 当然,这意味着SQL代理需要运行才能使会话过期。 这也意味着您需要在“实际”到期之前在“名义”到期后至少等待60秒。 如果需要,可以通过自己调用SP来强制到期。 The ... -
看看Facebook SDK for .NET Have a look at Facebook SDK for .NET
-
在asp.net中从我的sqlserver表中访问数据[关闭](Access data from my table of sqlserver in asp.net [closed])[2022-02-23]
我强烈建议阅读Scott Guthrie撰写的LINQ to SQL教程 LINQ to SQL是一种非常高效且简单的方法,用于检索数据库数据并将其置于易于访问的预先配置的可调整业务对象中。 我认为你会发现它是一个好的第一步。 第1部分:LINQ to SQL简介 第2部分:定义我们的数据模型类 第3部分:查询我们的数据库 第4部分:更新我们的数据库 第5部分:使用控件绑定UI 第6部分:使用存储过程检索数据 第7部分:使用存储过程更新我们的数据库 第8部分:执行自定 ... -
Asp.net 4.0 SQLServer 2008在英国托管[关闭](Asp.net 4.0 SQLServer 2008 hosting in the UK [closed])[2022-08-02]
不确定它是否真的适用于本网站,因为它不是直接编程本身... 无论如何,我使用Hosting UK进行我的虚拟主机托管,.NET 4.0和SQL 2008数据库都可用,以及中等信任环境,因此您可以在应用程序中包含其他二进制文件。 我也发现他们的支持非常好。 Not sure if it's really for this site, as it's not directly programming per se... Anyway, I use Hosting UK for my web hosting, . ... -
否 - EF4是仅支持.NET 4的技术,Visual Studio 2008不支持.NET 4。 No - EF4 is a .NET 4 only technology, and Visual Studio 2008 does not support .NET 4.
-
确保在SQL Server配置工具中将TCP / IP设置为传输。 Thanks guys for the try. I found the solution and it is related to an info that I forgot to give. I hope it can help someone as new as me on these things. I use NHibernate, and the connection string is actually in the nhib ...
-
好的,所以我的最终解决方案是在SQL中创建用户,并为他们提供密码,并在那里分配数据库。 然后,当他们登录时,程序使用会话变量来保存他们的登录数据。 此代码还测试登录信息,并将标签更改为SQL错误代码(如果生成了一个)。 如果测试通过,它只是重定向到目标页面。 Imports System.Data.SqlClient Public Class login Inherits System.Web.UI.Page Protected Sub LoginButton_Click(sender As Obje ...
-
ASP.NET 4.0和VS2008?(ASP.NET 4.0 and VS2008?)[2022-03-22]
您可以根本不使用Visual Studio开发.NET应用程序,因此您可以使用Visual Studio 2008作为这方面的有用工具,但是查看以前的Visual Studio版本,您不太可能获得.NET 4.0的一流支持特征。 就个人而言,我认为对你的问题的简短回答是“不”。 顺便说一句,ASP.NET动态数据已经在.NET Framework 3.5 SP1中提供,VS2008支持它。 You can develop .NET applications without Visual Studio at ... -
你需要jtds-1.2-dist.zip和jtds-1.2-dist.jar You'll need jtds-1.2-dist.zip with jtds-1.2-dist.jar in it