Skip to content
Advertisement

Can’t modify @Embedded List in Morphia

I have the following Entity:

JavaScript

The TodoList Object looks like this:

JavaScript

What I’m trying to do is to move a String from the todos ArrayList to the completed ArrayList inside a TodoList, here is how I’m trying to do that:

JavaScript

This doesn’t do anything and I have no clue of what could be wrong. Also, if I simply modify the full TodoList, moving the todo from the todos ArrayList to the completed ArrayList, and then using the set UpdateOperator like so:

JavaScript

It still doesn’t work, even thought I logged the todo variable and the userData and it all looks correct, I just can’t manage to save it into the DB.

I also tried this:

JavaScript

where removeTodo is (inside the TodoList Embedded class):

JavaScript

Advertisement

Answer

Well I should have checked my code twice. It appears that userData.getId() wasn’t the right ID of the user in the database :/

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement