Defining a different primary key in Mongomapper
- by ming yeow
I am defining a primary key in MongoMapper.
class B
key :_id, string
key :externalId, string
end
The problem is that everything i add a new record in B, it appears that I need to explicity specify the _id, when it is already defined in the external id
B.new(:_id=>"123", :external_id=>"123 )
That does not quite make sense. There should be a way to specify externalId as the primary key, no?