Add support for detecting when ids need to be cast to mongo ObjectIds