auto detect when a mongo style _id is used

Detects the type of primary key and sets it accordingly on save

This does not use ObjectId or introduce more depedencies, it is mainly a
change to facilitate using the memory plugin as a test harness for mongo
backed models