is it possible to filter fields other than _id like ObjectId
jacoffee opened this issue · 0 comments
jacoffee commented
For a collection like this:
> db.test.findOne()
{
"_id" : ObjectId("53478e5b0cf223985e8450bd"),
"account_id" : ObjectId("53479df455b86e5abcee5171"),
}
I can query with the _id like
"select * from test where _id = '56683613d4c6f325c9fe375c'"
but the following query does not seem to work:
"select * from test where account_id = '53479df455b86e5abcee5171' "
In MongoDB,it's natural to query as db.test.find({"account_id": ObjectId("53479df455b86e5abcee5171")})
I have read the source code.
private def checkObjectID(attribute: String, value: Any)(implicit config: Config) : Any
= attribute match {
case "_id" if idAsObjectId => new ObjectId(value.toString)
case _ => value
}
so what if the field goes into the wildcard pattern but it happens to be an ObjectId type, how I am gonna match that field?
So, do i miss something or you just do not support that kind of match at the moment? I am using 0.11.1。