Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed issue #1557 #1619

Merged
merged 4 commits into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGES_NEXT_RELEASE
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* #1535: Ignore Subscription::q when matching subscriptions for deletion of an entity
* #1542: Array Reduction (arrays of one single element are "flattened" to that very element)
* #1551: format=simplified for distribute GET /entities gave Normalized for entities from other brokers
* #1557: Cannot count entities if geo query with $near - mongodb doesn't allow it
* #1573: pagination not working when entities have the exact same creation date (sort also by entity id)
* #1583: If a 'q' contains an ampersand, that ampersand needs to be forwarded as a semicolon
* #1593: Modify the type of an entity in a Replace operation (only working in legacy mode)
Expand Down
12 changes: 12 additions & 0 deletions src/lib/orionld/mongoc/mongocEntitiesQuery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -777,6 +777,18 @@ KjNode* mongocEntitiesQuery
{
if (geoFilter(&mongoFilter, geoInfoP) == false)
return NULL;

//
// NOTE
// Counting doesn't work with $near|$nearSphere
// Must cancel the count in case it's requested, if it's a geo query with $near
//
if ((geoInfoP->georel == GeorelNear) && (countP != NULL))
{
LM_W(("Cannot count entities if georel is 'near'. MongoDB doesn't allow it"));
*countP = -2; // Mark the 'absense' of a count
countP = NULL; // This inhibits the count
}
}

bson_append_document(&options, "projection", 10, &projection);
Expand Down
Loading