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

error counting entities #1557

Closed
FR-ADDIX opened this issue Feb 15, 2024 · 13 comments
Closed

error counting entities #1557

FR-ADDIX opened this issue Feb 15, 2024 · 13 comments
Assignees
Labels
bug Something isn't working

Comments

@FR-ADDIX
Copy link

I have an error message, I would like to see the query that triggers this error, is there a way to do this?

ERROR@10:43:34 mongocEntitiesQuery.cpp[791]: Database Error (error counting entities: 17.5626500: $geoNear, $near, and $nearSphere are not allowed in this context)

I don't actually have a $near query anywhere in which I also count the entities.

ContextBroker Image: fiware/orion-ld:1.6.0-PRE-1577

@kzangeli
Copy link
Collaborator

That's weird ...
Most mongo queries have traces, so, real quick, just turn on all traces and see what comes out. ( -t 0-255).
If not enough, I'll add a call to LM_T for mongocEntitiesQuery.
(sorry, no time, in a meeting)

@FR-ADDIX
Copy link
Author

ContextBroker Image: fiware/orion-ld:1.6.0-PRE-1578 same Error

@kzangeli
Copy link
Collaborator

Did you get more info with -t 0-255?

@FR-ADDIX
Copy link
Author

ok I have the trigger:
a simple query with the following parameters.

http://orion-ld.fiware.svc:1026/ngsi-ld/v1/entities?type=EVChargingStation&idPattern=EVChargingStation&georel=near%3BmaxDistance==100&geometry=Point&coords=[10.178318,54.351428]

@kzangeli
Copy link
Collaborator

kzangeli commented Feb 16, 2024

Perfect.
The count part is an internal thing, needed for possible future pagination and distributed ops. Doesn't come from the user.
I might have to rethink that part in case of geoqueries, now that as it seems it doesn't work.
With this example I can take a look at how to avoid the problem.
So, big thank you!!! :)

@kzangeli kzangeli self-assigned this Feb 16, 2024
@kzangeli kzangeli added the bug Something isn't working label Feb 16, 2024
@kzangeli kzangeli mentioned this issue Feb 16, 2024
@FR-ADDIX
Copy link
Author

FR-ADDIX commented Jun 5, 2024

Hi Ken,

we now have an application running that generates a lot of geo based queries and as a result we get a lot of error messages of type

“mongocEntitiesQuery.cpp[798]: Database Error (error counting entities: 17.5626500: $geoNear, $near, and $nearSphere are not allowed in this context)”

These messages are triggered by this type of request:

/ngsi-ld/v1/entities/?georel=near%3BmaxDistance%3D%3D301&geometry=Point&coords=[10.1348%2C54.314]&limit=300&q=name~%3DTIER'

Is there a solution to get around this problem?
Our Orion version is orion-ld:1.6.0-PRE-1609

@kzangeli
Copy link
Collaborator

kzangeli commented Jun 5, 2024

Hello,

I believe I've seen that error before. If it is what I think, it had a logical explanation.
I'll search a little see if I can find it.

@kzangeli
Copy link
Collaborator

kzangeli commented Jun 5, 2024

Found it. What I was referring to is from this very issue.
Completely forgot about it, so sorry.
MongoDB doesn't allow for the count request when $near is in use.
It's an internal thing and I just have to avoid doing it.
We'll see how the absence of the number of matching entities affects the algorithm.
I've implemented the fix and functional tests are running.
Now we can only pray :))

kzangeli added a commit that referenced this issue Jun 5, 2024
@kzangeli
Copy link
Collaborator

kzangeli commented Jun 5, 2024

So, all tests passed - only because I have no functests depending on the entity count with georel=$near - I will get problems here some day in the future. I'll deal with that when we get there.

However, I can't merge the PR as we're having problems with the docker files, can't build.
There's a lost package, can't download it.
We're working on a complete modification of the dockerfiles.
This will hopefully be ready later today.
The PR will have to wait until then.

kzangeli added a commit that referenced this issue Jun 5, 2024
@kzangeli
Copy link
Collaborator

kzangeli commented Jun 5, 2024

PR merged.
Please test again and let me know, by closing the issue in case all is good, or, commenting on it if not.

@FR-ADDIX
Copy link
Author

FR-ADDIX commented Jun 6, 2024

is this in version fiware/orion-ld:1.6.0-PRE-1615?

Then it still doesn't seem to work but there is another error message:
"mongocEntitiesQuery.cpp[788]: Cannot count entities if georel is 'near'. MongoDB doesn't allow it"

@kzangeli
Copy link
Collaborator

kzangeli commented Jun 6, 2024

Yeah, that warning, not error, is new.
I need to do something to tell people it's not gonna work "completely, I can't just silently "eat" the problem.

You say "it still doesn't seem to work", what exactly do you mean with that? Is something failing, or are you just referring to the new warning?

@FR-ADDIX
Copy link
Author

Ah ok, that's just a warning now, you're right.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants