-
Notifications
You must be signed in to change notification settings - Fork 29
DOCSP-45358: documents #67
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
Changes from 4 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,93 @@ | ||||||
.. _mongoid-modeling-documents: | ||||||
|
||||||
========= | ||||||
Documents | ||||||
========= | ||||||
|
||||||
.. facet:: | ||||||
:name: genre | ||||||
:values: reference | ||||||
|
||||||
.. meta:: | ||||||
:keywords: ruby framework, odm, code example, bson | ||||||
|
||||||
.. contents:: On this page | ||||||
:local: | ||||||
:backlinks: none | ||||||
:depth: 2 | ||||||
:class: singlecol | ||||||
|
||||||
Overview | ||||||
-------- | ||||||
|
||||||
In this guide, you can learn about the ``Mongoid::Document`` module in | ||||||
{+odm+}. The ``Document`` module is a representation of a MongoDB | ||||||
document. To learn more about the terminology, structure, and limitations of | ||||||
MongoDB documents, see :manual:`Documents </core/document/>` in the | ||||||
{+server-manual+}. | ||||||
|
||||||
You must include the ``Mongoid::Document`` module in any class that you | ||||||
want to persist to MongoDB. By including the ``Document`` module in your | ||||||
model class, you can use its methods on instances of your model class. | ||||||
mayaraman19 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
The following code demonstrates how to include the ``Document`` module | ||||||
in a sample ``Person`` model class: | ||||||
|
||||||
.. code-block:: ruby | ||||||
:emphasize-lines: 2 | ||||||
|
||||||
class Person | ||||||
include Mongoid::Document | ||||||
|
||||||
field :name, type: String | ||||||
end | ||||||
|
||||||
You can find more information about the ``Document`` module in the `API | ||||||
documentation <{+api-root+}/Document.html>`__. | ||||||
|
||||||
MongoDB Representation | ||||||
|
||||||
---------------------- | ||||||
|
||||||
The representation of a ``Document`` in MongoDB is a BSON object that is | ||||||
|
The representation of a ``Document`` in MongoDB is a BSON object that is | |
A ``Document`` in MongoDB is represented by a BSON object that is |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reworded
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
of your models directly in a collection in the database, or you can | |
of your models directly in a collection, or you can |
or "database collection"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'm assuming this guide hasn't been created yet, but pointing this out just in case it has!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.