MongoDB - mongohub gui - queries by _id objectid type

I am using MongoHub GUI for MongoDB: http://mongohub.todayclose.com/

I would like to be able to query by ObjectId as this is what MongoHub is returing for _id. How to do this, something like {"_id":"4d1b4687a6d5437619000000"} is not working??

cheers, /Marcin

Answers


try following code:

{"_id": ObjectId("4d1b4687a6d5437619000000")}

check this for more details


It looks as if MongoHub is broken in the case of supplying a function in a query (ObjectId, as galimy rightly suggested). If you enter the query as galimy suggested, then copy and paste the full query that MongoHub says it's going to execute (grayed out above the Query text input) into a connected mongo CLI console, it works fine.

I would recommend learning to use the mongo console -- I've found two bugs in 5 minutes of playing with MongoHub, and when you're typing in JSON for your queries anyway the GUI is doing very little for you.


OK, it has been fixed in recent MongoHub release. Cheers


{"_id": { $oid: "4d1b4687a6d5437619000000"}} definitely should work. Java MongoDB driver implicitly creates ObjectId object in the object has '$oid' property. Also all the same is for date using '$date' property.


Need Your Help

Why string = “new value” does not compile?

c# .net

How I set new value for an string by index value?

problems when using Npgsql in SharpArchitecture

nhibernate postgresql npgsql sharp-architecture

Is there some guy can help me when using Npgsql in SharpArchitecture.I'm frustrated. I used Postgresql 8.4, Npgsql 2.0.11, SharpArchitecture 2.0.0.0, and visual studio 2010.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.