spring-data-mongodb
spring-data-mongodb copied to clipboard
Queries in MongoTemplate Logs with ObjectId Format.
When any operations made through MongoTemplate, I set the log level to DEBUG using the following configuration: logging.level.org.springframework.data.mongodb.core.MongoTemplate=DEBUG.
This allows me to view the queries executed by MongoTemplate, which is helpful. However, the issue is that the query logs display ObjectId in the oid format, which cannot be directly executed in the MongoDB Compass client.
Is there a way to log the queries in the ObjectId("") format instead? I couldn’t find a solution for this issue. If a solution already exists, please let me know. If not, it would be great to have this functionality implemented.
We use Document.toJson() which internally uses JsonMode.RELAXED. Logging is a recurring theme. Do you want to investigate how to introduce JsonWriterSettings for logging purposes in MongoTemplate and ReactiveMongoTemplate?
Yes, exactly what i am looking for.
@ganeshbabugb and/or @mp911de ,
I would like to provide a pull request. It is like starting from "scratch", because there is no pull request or feature branch, right ?
It is like starting from "scratch", because there is no pull request or feature branch, right ?
Exactly.