kareemgrant
9/8/2012 - 10:54 PM

strings in custom _id from mongodb are being stripped off when the record is referenced in ruby

strings in custom _id from mongodb are being stripped off when the record is referenced in ruby

1.9.3p194 :007 > hotel = Hotel.find("TA-505")
 => #<Hotel _id: 505, city: "Washington DC", created: 2012-03-06 20:55:04 UTC, data_source: "TA", hotel_class: 4, hotel_name: "Donovan House - A Kimpton Hotel", hotel_rank: 96, hotel_url: "http://www.tripadvisor.com/Hotel_Review-g28970-d939976-Reviews-Donovan_House_A_Kimpton_Hotel-Washington_DC_District_of_Columbia.html", overall_rating_list: 3.5, postal_code: "20005", rank_area: "Washington DC", region: "DC", remote_id: 939976, review_total_list: 28, street: "1155 14th Street, N.W.", updated: 2012-06-04 03:00:24 UTC> 
1.9.3p194 :008 > 
db.hotels.find({hotel_name:/^Donovan House/, data_source: "TA"})
{ "_id" : "TA-505", "hotel_class" : 4, "hotel_url" : "http://www.tripadvisor.com/Hotel_Review-g28970-d939976-Reviews-Donovan_House_A_Kimpton_Hotel-Washington_DC_District_of_Columbia.html", "updated" : ISODate("2012-06-04T03:00:24Z"), "review_total_list" : NumberLong(28), "overall_rating_list" : 3.5, "region" : "DC", "remote_id" : NumberLong(939976), "created" : ISODate("2012-03-06T20:55:04Z"), "street" : "1155 14th Street, N.W.", "city" : "Washington DC", "hotel_rank" : NumberLong(96), "postal_code" : "20005", "data_source" : "TA", "rank_area" : "Washington DC", "id" : NumberLong(505), "hotel_name" : "Donovan House - A Kimpton Hotel" }