TEST(CollectionOptions, ResetClearsCollationField) { CollectionOptions options; ASSERT_OK(options.parse(fromjson("{collation: {locale: 'en'}}"))); ASSERT_FALSE(options.collation.isEmpty()); options.reset(); ASSERT_TRUE(options.collation.isEmpty()); }
TEST(CollectionOptions, ResetStorageEngineField) { CollectionOptions opts; ASSERT_OK(opts.parse(fromjson("{storageEngine: {storageEngine1: {x: 1}}}"))); checkRoundTrip(opts); opts.reset(); ASSERT_TRUE(opts.storageEngine.isEmpty()); }
TEST(CollectionOptions, Validator) { CollectionOptions options; ASSERT_NOT_OK(options.parse(fromjson("{validator: 'notAnObject'}"))); ASSERT_OK(options.parse(fromjson("{validator: {a: 1}}"))); ASSERT_EQ(options.validator, fromjson("{a: 1}")); options.validator = fromjson("{b: 1}"); ASSERT_EQ(options.toBSON()["validator"].Obj(), fromjson("{b: 1}")); options.reset(); ASSERT_EQ(options.validator, BSONObj()); ASSERT(!options.toBSON()["validator"]); }