ProductPromotion
Logo

Ruby

made by https://0x3d.site

GitHub - spohlenz/mongomodel: Ruby ORM for MongoDB (compatible with Rails 3)
Ruby ORM for MongoDB (compatible with Rails 3). Contribute to spohlenz/mongomodel development by creating an account on GitHub.
Visit Site

GitHub - spohlenz/mongomodel: Ruby ORM for MongoDB (compatible with Rails 3)

GitHub - spohlenz/mongomodel: Ruby ORM for MongoDB (compatible with Rails 3)

MongoModel

MongoModel is a Ruby ORM for interfacing with MongoDB databases.

Build Status

Installation

MongoModel is distributed as a gem. Install with:

gem install mongomodel

For performance, you should probably also install the BSON C extensions:

gem install bson_ext

Using with Rails

Add MongoModel to your Gemfile (and run bundle install):

gem 'mongomodel'

Create the configuration file config/mongomodel.yml:

rails generate mongo_model:config DATABASENAME

Generating a model/document:

rails generate model Article title:string body:string published_at:time approved:boolean 

Generating an embedded document:

rails generate model Chapter title:string body:string -E

Sample Model

class Article < MongoModel::Document
  property :title, String, :default => 'Untitled'
  property :body, String
  property :published_at, Time, :protected => true
  property :approved, Boolean, :default => false, :protected => true
  
  timestamps!
  
  validates_presence_of :title, :body
  
  belongs_to :author, :class => User
  
  scope :published, where(:published_at.ne => nil)
end

Configuration

MongoModel can be configured similarly to ActiveRecord by creating/editing config/mongomodel.yml. The most basic configuration might look like:

development:
  database: mymongodbname
  host: localhost
  port: 27017

The config file also supports specifying the username, password, pool_size, password and replicas. Running rails generate mongo_model:config DATABASENAME will generate a basic config file for you.

Using Replica Sets

When working with replica sets, replace the host/port configuration with an array of replicas (host:port):

production:
  database: database_name
  replicas:
    - some.host.com:27017
    - another.host.com:27017
  username: username
  password: password

More Resources
to explore the angular.

mail [email protected] to add your project or resources here 🔥.

Related Articles
to learn about angular.

FAQ's
to learn more about Angular JS.

mail [email protected] to add more queries here 🔍.

More Sites
to check out once you're finished browsing here.

0x3d
https://www.0x3d.site/
0x3d is designed for aggregating information.
NodeJS
https://nodejs.0x3d.site/
NodeJS Online Directory
Cross Platform
https://cross-platform.0x3d.site/
Cross Platform Online Directory
Open Source
https://open-source.0x3d.site/
Open Source Online Directory
Analytics
https://analytics.0x3d.site/
Analytics Online Directory
JavaScript
https://javascript.0x3d.site/
JavaScript Online Directory
GoLang
https://golang.0x3d.site/
GoLang Online Directory
Python
https://python.0x3d.site/
Python Online Directory
Swift
https://swift.0x3d.site/
Swift Online Directory
Rust
https://rust.0x3d.site/
Rust Online Directory
Scala
https://scala.0x3d.site/
Scala Online Directory
Ruby
https://ruby.0x3d.site/
Ruby Online Directory
Clojure
https://clojure.0x3d.site/
Clojure Online Directory
Elixir
https://elixir.0x3d.site/
Elixir Online Directory
Elm
https://elm.0x3d.site/
Elm Online Directory
Lua
https://lua.0x3d.site/
Lua Online Directory
C Programming
https://c-programming.0x3d.site/
C Programming Online Directory
C++ Programming
https://cpp-programming.0x3d.site/
C++ Programming Online Directory
R Programming
https://r-programming.0x3d.site/
R Programming Online Directory
Perl
https://perl.0x3d.site/
Perl Online Directory
Java
https://java.0x3d.site/
Java Online Directory
Kotlin
https://kotlin.0x3d.site/
Kotlin Online Directory
PHP
https://php.0x3d.site/
PHP Online Directory
React JS
https://react.0x3d.site/
React JS Online Directory
Angular
https://angular.0x3d.site/
Angular JS Online Directory