I have tried MongoMapper and it is feature complete (offering almost all AR functionality) but i was not very happy with the performance when using large datasets. Has anyone compared with Mongoid? Any performance gains ?
...
In ruby, there are currently 3 ODM maintained:
MongoMapper
MongoID
MongoDoc
What is your prefered and why ?
...
I am using Rails and have to store 4 Models. Let's say a Post that has many and belongs to many Categories. Category on the other hand has many Qualities. At the moment I'm of the opinion, that Post and Categories are Documents. Qualities becomes an embedded Document of Categories.
We're coming to the root problem: There are a lot of Vo...
I have a collection with an index on :created_at (which in this particular case should be a date)
From rails what is the proper way to save an entry and then retrieve it by the date?
I'm trying something like:
Model:
field :created_at, :type => Time
script:
Col.create(:created_at => Time.parse(another_model.created_at).to_s
and
Co...
Hello,
I'm learning MongoDB through the Mongoid Ruby gem with Rails (Rails 3 beta 3), and I'm trying to come up with a way to create dynamic attributes on a model based on fields from another model, which I thought a schema-less database would be a good choice for.
So for example, I'd have the models:
class Account
include Mongoid::...
UPDATE 12th aug 2010: Although I got an accepted answer 6th may from Jackues Crocker, there are aspects of this issue that makes it easy to mess up! It happened to me yet again and I decided to research the mongoid source code. So, here it goes:
Currently, host: port: name/database: settings TAKE PRECEDENCE OVER the uri: setting. Hence...
As the title says, how can i generate the default mongoid.yml config file on Rail 2.3.5?
I try to use te ´rails generate mongoid:config´ command but it just generates a new app.
And also, i would like to use has_many in mongoid without embeding the associated model in the same field. I would like them to be in seperate fields and associ...
The behavior I'm observing with the Mongoid adapter is that it'll save 'time' fields with the current system timezone into the database. Note that it's the system time and not Rail's environment's Time.zone. If I change the system timezone, then subsequent saves will pick up the current system timezone.
# system currently at UTC -7
@r...
Hi!
I'm using rails3 edge and mongoid 2beta6 with ruby 1.9.2-head.
How can I manually change the table name, just like set_table_name for ActiveRecord? For example my model Signup should use the table "users" for storage, not "signups".
Another question is how to implement the bevahior of attr_accessible AR provides?
Thanks,
Corin
...
We are just giving MongoDB a test run and have set up a Rails 3 app with Mongoid. What are the best practices for inserting large datasets into MongoDB? To flesh out a scenario: Say, I have a book model and want to import several million records from a CSV file.
I suppose this needs to be done in the console, so this may possibly not be...
Greetings
I am trying to get Mongoid to work with my Rails app and I am getting
an error: "Mongoid::Errors::InvalidDatabase in 'Shipment bol should be
unique' Database should be a Mongo::DB, not NilClass"
I have created the mongoid.yml file in my config directory and have mongodb running as a daemon. The config file is like so:
d...
My question is similar to this one http://stackoverflow.com/questions/1342761/how-to-skip-activerecord-callbacks but instead of AR I'm using Mongoid, It seems like that isn't implemented yet in the current version of Mongoid, so I'd like to know what should be an elegant solution to implement it. (if necessary).
...
I'm using Rails 3 w/ Mongoid, (so no ActiveRecord). Mongoid uses ActiveModel's "to_json" method, and by default that method includes the root object in the JSON (which I don't want).
I've tried putting this in an initializer:
ActiveModel::Base.include_root_in_json = false
But get the error
uninitialized constant ActiveModel::Base
...
I'm at my wit's end trying to handle these errors. Basically, I've created the following User and Relationship patterns, using Mongoid to handle my database. This seems like a near-carbon copy of the example at the bottom of the page here. I'm trying to call any of the following:
user1.relationships.find(:all, :conditions => {:rel_us...
Embedded vs link
I'm looking for the fastest way to search a Newsletter document for a connected Email. So far I have used MongoMapper with one document for Newsletter and another for Email. This is getting really slow with +100k Emails.
I was thinking maybe its faster to embed the emails in an array inside Newsletter
since I'm really ...
I've got an app that I am building in Rails 3 (and MongoDB using Mongoid). I want to be able to send Apple Push Notifications to iOS devices. I am aware of PRX's apn_on_rails and samsoffes' apple_push_notification gems, but they do not appear to work correctly in Rails 3.
Are there any tutorials out there for setting up an APN server in...
I'm in the process of converting my Rails app to use mongodb through mongoid. I have two questions relating to indexes. I think I know the answer, but I want confirmation from someone who has more experience with mongodb.
Let's look at the following example where I have one relational association between Users and Posts.
user.rb
class...
I want to implement declarative authorization with mongoid. But cannot succeeded. It seems like declarative authorization works with ActiveRecord Only. Can I let it work with MOngoid and MongoDB? Any Ideas.
...
There is a similar question about 'bson_ext', but it's not work for me.
http://stackoverflow.com/questions/2900604/mongomapper-and-bson-ext-problem
I'm using Rails 2.3.8 + MongoId 1.9.1. I followed the "installation" page as:
gem install mongoid
gem install mongo -v=1.0.4
gem install bson_ext -v=1.0.4
In my config/environment.rb, I ...
I'm using MongoId 1.9.1, I defined a class like following:
class P
include Mongoid::Document
field :s, :type=>Array
end
We can see, the type of field 's' is String, but:
p = P.new
p.s = {:a=>1, :b=>2}
p.save()
It's saved with no error! And can be queried:
>> P.find(:last)
=> #<P _id: 4c3f0159e138231105000006, x: nil, s: {"b"=>...