Mongoid is an Object-Document-Mapper (ODM) for MongoDB written in Ruby.
0
votes
1answer
7 views
In Rails, How to construct a multiple input field form for same database field
I've just started Rails and I'm working on a simple logging app where I have a database (Mongodb) and Rails 3.x.x
The user is going to input, via text_area, 3 short text (:what) that will be stored ...
0
votes
1answer
16 views
Unable to perform a covered (indexOnly) query with mongoid
I have a query built around a composite index, and I've verified from the mongo shell that this query can run as an index only query.
Output:
db.merchants.find({st:{"$regex" : "cr", "$options": ...
0
votes
2answers
11 views
Find_by_slug with Mongoid method undefined
I am using Mongoid(3.0.23) and I want to add nicer URL's, I have followed this rails cast but for some reason my site throws an undefined error for the find_by_slug method. I have read about some gems ...
1
vote
1answer
20 views
Fire Child Callbacks on parent save (Force)
I am trying to trigger child callbacks for embeds many relations. For example:
class User
embeds_many :phones, cascade_callbacks: true
end
class Phone
embedded_in :user, inverse_of: :phones
...
0
votes
0answers
15 views
What is the right way of overriding bson_dump in my model?
ext = ExternalSource.new
Failure/Error: st = SearchTerm.create!(google_results: [ext])
NoMethodError:
undefined method `__bson_dump__' for #<ExternalSource:0x007fdb8bd23d90>
Should i ...
2
votes
1answer
17 views
Store functions in mongodb using Mongoid 3
Just as the title suggests. I am not able to find anything related to Mongoid 3. The things I found only apply to old versions of mongoid that didn't use Moped.
I found this and it doesn't work:
def ...
0
votes
2answers
16 views
delayed_job_mongoid is not writing data in backend
I have mongoid model
class RequestResponse
include Mongoid::Document
field :body, type: String
field :job_id, type: Fixnum
field :completed, type: Boolean
end
and according to rails cast I ...
0
votes
1answer
24 views
Retrieve an embedded document using Mongoid
I have a Mongoid document called Equipment which can embed multiple Question documents. Here are the document schemas:
class Equipment
include Mongoid::Document
include Mongoid::Timestamps
...
0
votes
1answer
12 views
Mongoid embedded documents not maintaining reference?
So this behavior is counter to what I would have expected. Let's say I have a document that has 1-n embedded images (well, the metadata for the images). I notice that if I do this:
...
0
votes
0answers
25 views
Best way to implement subset of relation in rails with mongoid?
I have three models in a rails application:
Class Member
include Mongoid::Document
has_and_belongs_to_many :organizations, inverse_of: :members
has_and_belongs_to_many :orgadmin, inverse_of: ...
-1
votes
0answers
67 views
attempt to create subdocument saves only “_id” value, ignoring the others fields on Rails 3 and Mongoid
product.rb
class Product
include Mongoid::Document
include Mongoid::Timestamps
field :name, type: String
field :price, type: BigDecimal
field :released_on, type: Date
attr_accessible ...
0
votes
3answers
145 views
undefined method `paginate' for Array on Rails 3 with mongoid
Trying to use will_paginate gem.
My Gem file has:
gem 'will_paginate', '~> 3.0.0'
My orders_controllers.rb:
def index
@orders = Order.all.paginate(:page => params[:page], :per_page ...
0
votes
1answer
29 views
Rails app with Mongoid not saving on update
I'm making a Rails app that uses Mongoid and devise. Currently, the functionality's pretty basic, but it's not working like I expect it to. In particular, update isn't working at all.
I can create a ...
0
votes
1answer
32 views
Mongoid batch insert with complicated schema?
I've been going all over the web looking for a solution to my problem. I' m using Mongoid to write a set of data to MongoDB.
I'm trying to do a batch insert with mongoid as follows:
class Geonode
...
0
votes
1answer
21 views
Mongoid strange query result
I'm using MongoDB through Mongoid with Rails 3 and observe this strange behavior when doing query in rails console:
> Table.where(:field => {"$exists" => true}).count
=> 3735
> ...