-
-
Notifications
You must be signed in to change notification settings - Fork 504
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
dbref $id persisted as string instead of objectid #2
Comments
will look into it, thanks |
Can you create the issue in jira? |
So I just pulled this, and now I have an issue. In my query, I do this: I get nothing as the response. I can't find anything in the query docs to see how to build my query to make this work. |
Try ...->equals(new \MongoId($userId)); |
What does gist mean? Sorry, new to a lot of this. |
This should be fixed. The $id is stored as a MongoId properly now. |
Besides the identify field of the document, how do you store a MongoId in some other field? in cases where I'm manually referencing documents. I don't want to store them as strings. I've explained my issue here: http://stackoverflow.com/questions/6644033/how-do-you-store-an-objectid-while-using-doctrine-mongodb-odm |
now with phpcbf
I've noticed this when playing around with the sandbox and references:
(output of mongo shell)
db.testcollection.findOne().references[0]
{ "$ref" : "testreference", "$id" : "4c3f0b456cc8849c17ab0000" }
The $id of the dbref here is a string, but I would expect it to be an ObejctId (a MongoId in PHP), like so:
db.testcollection.findOne().references[0]
{ "$ref" : "testreference", "$id" : ObjectId("4c3f0b456cc8849c17ab0000") }
This allows for...
db.testcollection.findOne().references[0].fetch()
{ ... referenced document here ... }
I couldn't find a note if this was intended by the odm or not, but an ObjectId is the proper format, here:
http://www.mongodb.org/display/DOCS/Database+References
The text was updated successfully, but these errors were encountered: