diff options
Diffstat (limited to 'src/mongo/db/matcher/expression_parser.h')
-rw-r--r-- | src/mongo/db/matcher/expression_parser.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/mongo/db/matcher/expression_parser.h b/src/mongo/db/matcher/expression_parser.h index f997b4c1a49..bfc3affbff4 100644 --- a/src/mongo/db/matcher/expression_parser.h +++ b/src/mongo/db/matcher/expression_parser.h @@ -148,5 +148,14 @@ public: * - Too large in the positive or negative direction to fit within a 64-bit signed integer. */ static StatusWith<long long> parseIntegerElementToLong(BSONElement elem); + + /** + * Parses a BSONElement of any numeric type into an integer, failing if the value is: + * + * - NaN + * - a non-integral number + * - too large in the positive or negative direction to fit in an int + */ + static StatusWith<int> parseIntegerElementToInt(BSONElement elem); }; } // namespace mongo |