SamuelTallet / MongoDB-PHP-GUI

Open-source graphical interface for MongoDB database. Written in PHP, JavaScript, HTML & CSS.
142 stars 33 forks source link

How to query an ObjectId field not named _id? #39

Open aldokkani opened 1 year ago

aldokkani commented 1 year ago

I cannot query based on objectId in this thing. {key: "\<id>"} doesn't work {key: ObjectId("\<id>")} doesn't work either!

SamuelTallet commented 1 year ago

Let ObjectId("6f358e03c3360000ef0076d4"), you can query with:

{ _id: "6f358e03c3360000ef0076d4" }

or

_id: "6f358e03c3360000ef0076d4"
aldokkani commented 1 year ago

The key in my case is "definitionId" it is not the _id and no this doesn't work {definitionId: "someid"}

SamuelTallet commented 1 year ago

Ah! That's why! 😉 Only ObjectId fields named _id are supported by MongoDB PHP GUI for now.