| Start |
|---|
| Fields As per the Mongoid Documentation (opens new window), there are 16 valid field types:
To add a field (let's call it To set a default value, just pass in the |
| Installation First, add and then run After installation, run the generator to create the config file: which will create the file |
| Creating a Model Create a model (lets call it which will generate the file This is all you need to have a model (albeit nothing but an Timestamps are not automatically included in your model when you generate it. To add to your model underneath |
| Classic Associations Mongoid allows the classic
To add an association (lets say the User and this to your This will add a |
| Embedded Associations Mongoid allows Embedded Associations:
To add an association (lets say the User and this to your This will embed |
| Database Calls Mongoid tries to have similar syntax to |
Read Article
https://develop.horje.com/learn/1434/reference