I have a users table/collection and would like to upsert a user - update a user if exists or add a new one if still not exists. Structure below.
By "exists", I mean having some external ID. In this case, googleId
.
How can I do it using Jongo library? Thanks.
public class User {
public String _id;
public String email;
public String givenName;
public String familyName;
public String googleId;
}
Considering having a user with an already loaded googleId (passed google auth), and I'd like to upsert it to mongoDB, using Jongo: