summaryrefslogtreecommitdiff
path: root/src/mongo/db/matcher/expression_geo.cpp
diff options
context:
space:
mode:
authorLucas de Castro Borges <lucas@gnuabordo.com.br>2025-02-11 15:07:35 -0300
committerLucas de Castro Borges <lucas@gnuabordo.com.br>2025-02-11 15:07:35 -0300
commit4cb8841196d0625dfa3825aa326f071cd27c7b8b (patch)
tree1682a647d4463397c119183369ae6f750d5fdcff /src/mongo/db/matcher/expression_geo.cpp
parentaa03c6362cbaa767638e6eed9b031d86dd2643d1 (diff)
parent8f0827553e09872941945a093b647a4211a9db7f (diff)
Update upstream source from tag 'upstream/6.0.0'master
Update to upstream version '6.0.0' with Debian dir 5604a80ec1c96ca76f25f40d78e6ef855abec322
Diffstat (limited to 'src/mongo/db/matcher/expression_geo.cpp')
-rw-r--r--src/mongo/db/matcher/expression_geo.cpp32
1 files changed, 9 insertions, 23 deletions
diff --git a/src/mongo/db/matcher/expression_geo.cpp b/src/mongo/db/matcher/expression_geo.cpp
index 9050de83741..fe592df742e 100644
--- a/src/mongo/db/matcher/expression_geo.cpp
+++ b/src/mongo/db/matcher/expression_geo.cpp
@@ -33,7 +33,6 @@
#include "mongo/bson/simple_bsonobj_comparator.h"
#include "mongo/db/geo/geoparser.h"
-#include "mongo/db/matcher/expression_geo_serializer.h"
#include "mongo/db/matcher/expression_parser.h"
#include "mongo/logv2/log.h"
#include "mongo/platform/basic.h"
@@ -245,11 +244,6 @@ Status GeoNearExpression::parseNewQuery(const BSONObj& obj) {
if (fieldName == "$geometry") {
if (e.isABSONObj()) {
BSONObj embeddedObj = e.embeddedObject();
- // TODO SERVER-84598: $geoNear queries don't do a type check on the type of the
- // geometry provided into the query. This is different than the behaviour we see for
- // other GeoExpressions that use a GeometryContainer. GeoNear is a special case that
- // only ever has type 'Point', however it may be a good idea to consider removing
- // this silent acceptance of invalid "type" in the long term.
Status status = GeoParser::parseQueryPoint(e, centroid.get());
if (!status.isOK()) {
return Status(ErrorCodes::BadValue,
@@ -432,7 +426,7 @@ void GeoMatchExpression::debugString(StringBuilder& debug, int indentationLevel)
_debugAddSpace(debug, indentationLevel);
BSONObjBuilder builder;
- serialize(&builder, {});
+ serialize(&builder, true);
debug << "GEO raw = " << builder.obj().toString();
MatchExpression::TagData* td = getTag();
@@ -443,14 +437,10 @@ void GeoMatchExpression::debugString(StringBuilder& debug, int indentationLevel)
debug << "\n";
}
-void GeoMatchExpression::appendSerializedRightHandSide(BSONObjBuilder* bob,
- const SerializationOptions& opts,
- bool includePath) const {
- if (opts.literalPolicy != LiteralSerializationPolicy::kUnchanged) {
- geoExpressionCustomSerialization(*bob, _rawObj, opts, includePath);
- return;
- }
- bob->appendElements(_rawObj);
+BSONObj GeoMatchExpression::getSerializedRightHandSide() const {
+ BSONObjBuilder subobj;
+ subobj.appendElements(_rawObj);
+ return subobj.obj();
}
bool GeoMatchExpression::equivalent(const MatchExpression* other) const {
@@ -505,14 +495,10 @@ void GeoNearMatchExpression::debugString(StringBuilder& debug, int indentationLe
debug << "\n";
}
-void GeoNearMatchExpression::appendSerializedRightHandSide(BSONObjBuilder* bob,
- const SerializationOptions& opts,
- bool includePath) const {
- if (opts.literalPolicy != LiteralSerializationPolicy::kUnchanged) {
- geoNearExpressionCustomSerialization(*bob, _rawObj, opts, includePath);
- return;
- }
- bob->appendElements(_rawObj);
+BSONObj GeoNearMatchExpression::getSerializedRightHandSide() const {
+ BSONObjBuilder objBuilder;
+ objBuilder.appendElements(_rawObj);
+ return objBuilder.obj();
}
bool GeoNearMatchExpression::equivalent(const MatchExpression* other) const {