Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mongoid gives uninitialized constant Mongo

I'm trying to use mongoid but it outputs this error:

uninitialized constant 'Mongo'

Here is my code:

require "mongoid"

Mongoid.configure do |config|
    config.master = Mongo::Connection.new("localhost",27017).db("arthist")
end

class Artist
    include Mongoid::Document
    field :name, type: String
end 

a = Artist.create(name: "hoge")

Do you have any idea?

like image 704
nobinobiru Avatar asked Dec 21 '25 11:12

nobinobiru


1 Answers

include gem mongo in your Gemfile and restart the server it should do the trick.

like image 96
abhas Avatar answered Dec 23 '25 00:12

abhas