-
-
Notifications
You must be signed in to change notification settings - Fork 502
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
QueryBuilder API: \MongoRegex instances on string typed identifier fields get discarded #1294
Comments
I agree that ODM should let you do so :) Tagged it as a bug and hopefully I'll get back to it shortly |
@malarzm thanks very much; I'll update the StackOverflow question.. I'm not into active development here, is there anything I can help? Would it be a quickfix in |
From top of my head I'd suggest the DocumentPersister and additional check.
|
@malarzm so this bug apparently only appears if:
what workslet's consider this annotation class: /** @ODM\Document */
class GH1294User
{
/** @ODM\Id(strategy="UUID") */
public $id;
/** @ODM\String */
public $name = false; this works as expected, as what doesn't worksee this annotation (note /** @ODM\Document */
class GH1294User
{
/** @ODM\Id(strategy="UUID", type="string") */
public $id; only now, we see that wrong behavior described here. now, now @malarzm, I discovered that
so then:
i renamed this issue to reflect the issue more precise. |
@narcoticfresh thank you very much for digging into this!
I concur :)
I think so, I wouldn't expect anyone to use |
@malarzm did u push that said branch? i don't really get what you're saying (how you prepare those values).. i created a failing unit test that should be green when the bug is ironed out.. |
Given this query:
will not yield any results because driver will use string in query and that will not match any document in database. Obviously it's simple to cast such variables values to
Unfortunately no, I started working on that last week but afterwards went to Paris and haven't gotten back to that yet. |
Hi guys
There is a proprietary behavior when a user issues an
equals()
on an identifier field usingQueryBuilder
as opposed to a 'normal' field (see DocumentPersister).If I do this:
Then check
$builder->getQueryArray()
I get:As you can see, the
MongoRegex
instance is lost and the query doesn't work as expected.I don't know if this is a feature, a bug or wrong usage - so I first created a StackOverflow question detailing this issue:
http://stackoverflow.com/questions/34061566/doctrine-2-odm-querying-id-field-with-mongoregex-like
I'm creating this issue in the hopes to get some answer why doctrine-odm behaves that way as it does or to get an answer how one can do a Regex-based search on an identifier field..
IMHO Doctrine should not intervene in a feature that is possible using MongoDB shell. As all our IDs are strings and not
MongoID
s, I see no reason why myMongoRegex
gets converted to a plain string. What am I missing?Thanks so much!
The text was updated successfully, but these errors were encountered: