diff options
-rw-r--r-- | src/mongo/db/fts/fts_spec.cpp | 3 | ||||
-rw-r--r-- | src/mongo/db/fts/fts_spec_test.cpp | 6 |
2 files changed, 7 insertions, 2 deletions
diff --git a/src/mongo/db/fts/fts_spec.cpp b/src/mongo/db/fts/fts_spec.cpp index 238065983cb..eb534f10a3e 100644 --- a/src/mongo/db/fts/fts_spec.cpp +++ b/src/mongo/db/fts/fts_spec.cpp @@ -301,7 +301,8 @@ namespace mongo { BSONElement e = i.next(); if ( str::equals( e.fieldName(), "_fts" ) || str::equals( e.fieldName(), "_ftsx" ) ) { - continue; + addedFtsStuff = true; + b.append( e ); } else if ( e.type() == String && ( str::equals( "fts", e.valuestr() ) || diff --git a/src/mongo/db/fts/fts_spec_test.cpp b/src/mongo/db/fts/fts_spec_test.cpp index 541bd4a56d8..df4ff719f02 100644 --- a/src/mongo/db/fts/fts_spec_test.cpp +++ b/src/mongo/db/fts/fts_spec_test.cpp @@ -97,10 +97,14 @@ namespace mongo { TEST( FTSSpec, Extra2 ) { BSONObj user = BSON( "key" << BSON( "data" << "fts" << "x" << 1 ) ); - FTSSpec spec( FTSSpec::fixSpec( user ) ); + BSONObj fixed = FTSSpec::fixSpec( user ); + FTSSpec spec( fixed ); ASSERT_EQUALS( 0U, spec.numExtraBefore() ); ASSERT_EQUALS( 1U, spec.numExtraAfter() ); ASSERT_EQUALS( StringData("x"), spec.extraAfter(0) ); + + BSONObj fixed2 = FTSSpec::fixSpec( fixed ); + ASSERT_EQUALS( fixed, fixed2 ); } TEST( FTSSpec, Extra3 ) { |