Skip to content

Debug line for count() call in ReactiveMongoTemplate happens twice #4322

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

Open
rhanton opened this issue Mar 8, 2023 · 2 comments
Open

Debug line for count() call in ReactiveMongoTemplate happens twice #4322

rhanton opened this issue Mar 8, 2023 · 2 comments
Assignees
Labels
type: bug A general bug

Comments

@rhanton
Copy link

rhanton commented Mar 8, 2023

I was noticing that the exact same debug statement is duplicated in
https://github.com/spring-projects/spring-data-mongodb/blob/main/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/ReactiveMongoTemplate.java#L1153

and on the underlying method call at
https://github.com/spring-projects/spring-data-mongodb/blob/main/spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/ReactiveMongoTemplate.java#L1172

So if we have debug logging turned on, it looked like perhaps the [expensive] count query is being done twice, but really it only happens once. I'd suggest changing or removing the debug statement on line 1153 in favor of 1172.

As it is today, the output (with debug turned on of course) looks like this, though count is only executed once:

2023-03-08T13:07:50.389-07:00 DEBUG 21153 --- [ctor-http-nio-3] o.s.d.m.core.ReactiveMongoTemplate       : Executing count: { "tenantId" : "effa4be0-573d-11e9-8647-d663bd873d93", "$or" : [{ "language" : { "$regularExpression" : { "pattern" : "en", "options" : "i"}}}, { "language" : { "$regularExpression" : { "pattern" : "fr", "options" : "i"}}}]} in collection: session
2023-03-08T13:07:50.390-07:00 DEBUG 21153 --- [ctor-http-nio-3] o.s.d.m.core.ReactiveMongoTemplate       : Executing count: { "tenantId" : "effa4be0-573d-11e9-8647-d663bd873d93", "$or" : [{ "language" : { "$regularExpression" : { "pattern" : "en", "options" : "i"}}}, { "language" : { "$regularExpression" : { "pattern" : "fr", "options" : "i"}}}]} in collection: session
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Mar 8, 2023
@christophstrobl
Copy link
Member

related to #4253

@christophstrobl christophstrobl added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged labels Mar 9, 2023
@abimael-turing
Copy link

Hi @christophstrobl, may I assist you with this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

5 participants