Top "Mongoid" questions

Mongoid is the official Ruby Object-Document-Mapper (ODM) for MongoDB.

How do I get all attributes of a Model minus a few

So I'm writing a rspec test. It will test if a model is duplicated correctly. So the spec is something …

ruby-on-rails rspec mongoid
How to skip callbacks on Mongoid Documents?

My question is similar to this one How to skip ActiveRecord callbacks? but instead of AR I'm using Mongoid, It …

ruby-on-rails ruby activerecord mongoid
Mongoid pagination

I tried @posts = Post.page(params[:page]).per_page(10) and @posts = Post.paginate(:page => 1, :per_page => 10) but neither …

pagination mongoid
Mongoid date range query

I can't seem to find anything to make a date range query using Mongoid/Rails. Below are some queries I've …

ruby-on-rails mongodb mongoid
Using Active Record generators after Mongoid installation?

I'm using MongoDB via Mongoid integration, as well as ActiveRecord in a project. I would like to generate migrations for …

ruby-on-rails activerecord mongoid mongodb
Factory Girl + Mongoid embedded documents in fixtures

Let’s say you have the following mongoid documents: class User include Mongoid::Document embeds_one :name end class UserName …

ruby-on-rails embed mongoid factory-bot fixtures
MongoID find or find_by

The MongoID docs seem to be pretty clear that I should be able to run this and have it work: …

ruby mongodb mongoid
How to reference an embedded document in Mongoid?

Using Mongoid, let's say I have the following classes: class Map include Mongoid::Document embeds_many :locations end class Location …

ruby mongodb mongoid
Forms to create and update Mongoid array fields

I've been struggling to create a form for a Mongoid model that has an array field. I want my form …

ruby-on-rails ruby mongodb mongoid fields-for
Moped::Errors::ConnectionFailure Could not connect to any secondary or primary nodes for replica set

I had to forcefully shutdown my Ubuntu system after it got hanged. Now I get this error while trying to …

mongoid mongoid3