MongoDB-PHP-GUI icon indicating copy to clipboard operation
MongoDB-PHP-GUI copied to clipboard

How to query an ObjectId field not named _id?

Open aldokkani opened this issue 3 years ago • 3 comments

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

aldokkani avatar Oct 14 '22 14:10 aldokkani

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

{ _id: "6f358e03c3360000ef0076d4" }

or

_id: "6f358e03c3360000ef0076d4"

SamuelTallet avatar Oct 28 '22 12:10 SamuelTallet

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

aldokkani avatar Oct 28 '22 13:10 aldokkani

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

SamuelTallet avatar Oct 28 '22 13:10 SamuelTallet