Add unit test for serializing const objects to BSON. See #654.