Permalink
Browse files

added exception when a member map is used with an _id alias.

  • Loading branch information...
1 parent 804c3fd commit e04ebe2aeccd3297c3a8819ac5f6db3302226afe @craiggwilson craiggwilson committed Jun 24, 2010
Showing with 3 additions and 0 deletions.
  1. +3 −0 source/MongoDB/Configuration/Mapping/Model/ClassMapBase.cs
@@ -219,6 +219,9 @@ internal void AddMemberMap(PersistentMemberMap memberMap)
/// <param name = "memberMaps">The member maps.</param>
internal void AddMemberMaps(IEnumerable<PersistentMemberMap> memberMaps)
{
+ if (memberMaps.Any(m => m.Alias == "_id"))
+ throw new MongoException("_id is a reserved MongoDB alias and cannot be used for anything other than an Id column.");
+
_memberMaps.AddRange(memberMaps);
}

0 comments on commit e04ebe2

Please sign in to comment.