This example makes it seem like both are used (included) in order to make a class a persistent model, but it is not clear when I should use one or the other.
This example makes it seem like both are used ( include d) in order
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
A
MongoMapper::Documentis saved to the database as a top-level record. AMongoMapper::EmbeddedDocumentis saved within another document. For instance, let’s say I have a blogging application. I have aPostandCommentmodel. They might look something like this:Will produce a document in your mongo database that looks like this:
In terms of interacting with them through MongoMapper, only a
MongoMapper::Documentresponse to methods likefindandsave. AMongoMapper::EmbeddedDocumentcan only be accessed through its parent document. The implication of this is that you should only useMongoMapper::EmbeddedDocumentfor models that are clearly subsidiary to their parent models and will only be used in the context of that parent.