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

upsert of $inc with map of map throwing ValidationException #3070

Open
ball3t opened this issue Jun 4, 2024 · 1 comment
Open

upsert of $inc with map of map throwing ValidationException #3070

ball3t opened this issue Jun 4, 2024 · 1 comment
Labels

Comments

@ball3t
Copy link

ball3t commented Jun 4, 2024

I have an document like this:

{
    "resultCounts": {
        "abc": {
            "count1": 10,
            "count2": 0
        },
        "def": {
            "count1": 0,
            "count2": 20
        }
    }
}

and the java codes are like:

public class SomeLog {
  private Map<String, Map<String,Integer>> resultCounts;
  ...
}

when I try to do an upsert using this:

updates.add(inc("resultCounts.abc.count1", 1));
getDatastore().find(SomeLog .class).filter(eq("id", id)).update(updates).execute(new UpdateOptions().upsert(true));

it throws exception:

Failed to process request to: [{"expectMultipart":false,"paramsCharset":"UTF-8","ended":false,"ssl":false}]: dev.morphia.query.ValidationException: Could not resolve path 'resultCounts.abc.count1' against 'com.kn.fitnext.common.entity.DcLog'.  Unknown path element: 'count1'.

** Please complete the following information: **
Server Version: 6.0.12
Driver Version: 4.9.1
Morphia Version: 2.2.10

@ball3t ball3t added the question label Jun 4, 2024
@evanchooly
Copy link
Member

This one sounds familiar. Can you try with 2.4.13 and see if it still happens? I feel like I fixed something similar recently.

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

No branches or pull requests

2 participants