Extracted some common EmbeddedMongoDB functions.