MongoDB-Rox / phpMoAdmin-MongoDB-Admin-Tool-for-PHP

MongoDB administration tool for PHP built on a stripped-down version of the Vork high-performance framework

Home Page:http://www.phpMoAdmin.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How do I search for ObjectIds?

niccottrell opened this issue · comments

In the Search field, I've tried:

  • just the ID as a string
    • "ObjectId('123abc456def789')"
    • "{"$oid": "123abc456def789"}

none of which work. Also tried in query:

  • "{"_id" : ObjectId('123abc456def789')}"
  • "{"_id" : {"$oid": "123abc456def789"}}"

which don't work either.

What is the correct syntax for the GUI? Maybe we could have a special value in the pulldown menu like "_id.$id" for doing quick exact ID matches

I think its just using the key "123abc456def789". Nothing else.

Hello guys,
First I want to tell you that I really enjoy this scrip and and I love when the things are simple and fast so thanks for owner.

The biggest problem for me was always the search by ID( _id , ObjectID ) and was somehow disappointed that i didn't find out any information in this thread. Anyway as soon as I found a solution decided to share it with all of you (the person who added the question and and others that will come here for answers as me):

You select QUERY as the SELECT is not working in this case and write something like this:

array(
           '_id' => new MongoId('ObjectID')
)

Example:

array(
       '_id' => new MongoId('500c8b26eefc6f5d61000000')
)

It is working and I really hope this solution is universal though I'm not sure as I have tested it only in one environment so if for you is working let us all know and the author can close this issue.

Update:

You can use the full string, eg:

(MongoId) 533584f9897afb583f8b4569

ChrisGitIt answered this accurately - just search for the ObjectID as if it is a string (it works.)

yeah, works like this

image