-
Notifications
You must be signed in to change notification settings - Fork 672
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
Property path with whitespace inconsistently throws exception #3121
Comments
Thank you @boly38 for getting in touch. Spring Data MongoDB is mainly operating upon the java domain model and does not necessarily have the same behaviour as when using the Mongo Shell. That being said, From what I understand is that you are storing data in MongoDB, using keys that contain leading whitespaces like the following right? {
"_id": "...",
"name": "docA",
"properties": {
" Major": "blob"
}
} I think we'll have to deal with this issue both here (path resolution) and in data-mongo (handling of fields containing whitespaces). |
Hi here 👋 ,
What is the issue ?
On my project I want to update a given MongoDB document having
properties
map as subdocument.I'm using
org.springframework.data:spring-data-commons:jar:3.1.11
(and spring data mongodb 4.1.11) .I encounter
IllegalArgumentException: Name must not be null or empty
fromPropertyPath.java:82
while trying to patch a given documentproperties
.Context - How to reproduce ?
ℹ️ A usecase - I encounter no issue to set / unset a property having " " space in the beginning of a property key value with a word starting with lowercase; example :
ℹ️ B usecase - BUT now if I'm doing the same thing with a word starting with an uppercase, I encounter an issue :
stack extract
Further analysis
By debugging some test with different value, I can state that
spring-data-commons
>PropertyPath
component is processing some part of the update query and will see some field following spring data internal logic :ooo
is detected under propertiesP
andWith mongo Shell, I'm trying to reproduce but no issue, all is fine (usecase B too)
What did I expect
I expect the update to work like on mongo shell.
I though this is a bug at the PropertyPath layer (but not sure) Or maybe in spring data mongodb?
If this is stated as "not a bug",
I would like to know the recommendation for this kind of update for the "key" value.
Example (mongo manual):
class
and_class
,.
is not autorized$
is not autorized as first characterI appreciate some reference to complete this, if any
regards.
The text was updated successfully, but these errors were encountered: