-
Notifications
You must be signed in to change notification settings - Fork 127
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
_id always blank in embedded documents #184
Comments
@bdtomlin This is definitely surprising. Here's why it's not happening now: For a root document, the MongoDB server generates the ObjectId and returns it (though you can also insert a document with an _id of your own creation). When you're inserting/updating an embedded document, mongo doesn't see it as a document it needs to assign an Looking towards the future, should the adapter try to generate the |
I'm not sure how mongoid (ruby) handles this, but the _id is added by default in embedded documents. I believe there is an option to disable that. I think it should probably be the default here to add the _id as well. It looks like it is for the other mongo libraries. If I get some time I'll try to look into it. I know elixir-mongo has a function for generating an object id here: https://github.com/elixir-mongo/mongodb/blob/6ae204966e0842c852466431c9fcb06056e1ceb9/lib/mongo.ex#L152-L158 |
It would be great if |
Using
embedded_schema
like in the example below always just ends up with a null_id
in the database. I would expect it to populate the object id just like it does when using a regularschema
.The text was updated successfully, but these errors were encountered: