Defining a different primary key in Mongomapper
Posted
by
ming yeow
on Stack Overflow
See other posts from Stack Overflow
or by ming yeow
Published on 2010-12-03T03:45:04Z
Indexed on
2010/12/31
18:54 UTC
Read the original article
Hit count: 226
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?
© Stack Overflow or respective owner