kidpollo / tanker

IndexTank Integration with your fav ORM

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Mongoid as ORM

e10jon opened this issue · comments

Indexing doesn't work with Mongoid as on ORM because Mongoid stores IDs as a BSON::ObjectId, not as a String or a Number (which yields the error "ArgumentError: "Value for field __id is not a String nor a number""). Any chance of adding a fix for this? I think I'll fork and give it a whirl.

it should be very simple just make sure it does not cause regressions. I will gladly review your pull request as soon as you push it. I will try to get around to fix some bugs next week thanks again for reporting this.

Hi !

I have not had the time to look into this. I would like to add more integration tests with other ORMs.

Let me know if you have had any luck or if I can help

Could you provide a stacktrace? We are using MongoMapper without any issues and MM's id method does not do any conversions from ObjectId.

@kidpollo Do you think forcing the id attribute to a string is a bad idea? Most (all?) ORM's should have some sort of conversion from strings when setting the id column.

Ah, I see now that I read the Mongoid spec's a bit sloppy, they do not convert strings to objectid's when going through the id setter.. Hmm. Having to typecast values in tanker seems a bit much tbh..

I dont think its a bad idea what I do wish is that I could have an Integration test suite that worked with mongo based ORMs that did not require to have mongo running. I got away with active record with a sql lite backend but I dont know if this can be achieved with mongo. Any suggestions?

I recently merged a commit to master that seems to fix this. Please let me know if this is still an issue