ruby-on-railsmongodbmongoidmongomapper

Rails: Store JSON in MongoDB


I am getting multiple similar JSON object from a remote site and looking to store them in a local MongoDB.

What would be the best way to do this ? (Preferably via Mongoid or Mongo-mapper gems)

Thanks


Solution

  • You can use a mongoid field of type Hash or an embedded document.

    class MyModel
      include Mongoid::Document
      field :some_data, :type => Hash
    end