Can't run examples in README.md #2

Closed
fuJiin opened this Issue May 11, 2010 · 5 comments

Projects

None yet

2 participants

@fuJiin

I'm pretty new to this. But when I try to run the examples in the readme, I get the following error:

/gems/light_mongo-0.4.0/lib/document/serialization/hash_serializer.rb:58:in `rescue in natively_embeddable?': uninitialized constant Mongo::InvalidDocument (NameError)

I can provide the full-trace and my code if you're interested, but maybe I'm just doing something incredibly stupid. Any ideas what's wrong? I'm using Ruby 1.9.

@elliotcm
Owner

Hi there.

I've not fully tested LM under 1.9, could you tell me specifically which example exploded?

@fuJiin

It's blowing up for all of them. The problem is when you call save on the object.

I have the following:

LightMongo.database = "mydb"

class Person
  include LightMongo::Document
end

person = Person.new(
  :first_name => "Bruce",
  :last_name => "Lee",
  :age => "dead"
)

person.save

ap Person.find.first

If I take out person.save the code will run fine, returning an empty array of Person objects. But if I try to save it, or change the code to person = Person.create() it will break.

I've also checked the console and the database "mydb" exists.

@elliotcm
Owner

Okay so this may or may not be a direct issue with 1.9, but it's definitely an issue with the ruby mongo driver.

There was recently a 1.0 release which breaks a few bits and pieces, and is going to be more than a five minute fix.

I would recommend using mongo gem version 1.19.1 and ruby 1.8.6 until I can do some work to make these more flexible.

@elliotcm
Owner

Whoops, that's 0.19.1.

@fuJiin

Okay will do. Keep me updated when you release the next version of light_mongo. I think it's a great idea.

@fuJiin fuJiin closed this Jul 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment