Replies: 1 comment
-
|
Hm. I didn't think about this case, but it looks like it needs some syntax sugar like set_or_insert, yup. Or just ignore the id there. I have to think about all the corner cases. I'll add this to my todo. Thank you! |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
As part of creating a user, i'm using upsert which would allow me to neatly cover the case of 1- user does not exist and 2- user exists
I want to update all the user details in case they exist, except for the ID obviously.
But in order to do that, I need to pass in all the properties except for the ID in the upsert update section
Set(user_dict).Doesn't it make sense for Beanie to take care of ignoring the ID in the case of updating inside upsert?
Passing it in with the ID results in a serialization error on creation, and in a NULL ID on the database document which is not good. That's why I need to create a dict without the ID here.
Beta Was this translation helpful? Give feedback.
All reactions