Announcement Announcement Module
Collapse
No announcement yet.
Upsert and _class field Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Upsert and _class field

    Hi all,

    I found that when insert new document through upsert the _class field is not initialized.

    String email = "alex[email protected]"
    WriteResult result = mng.upsert(Query.query(Criteria.where("email").is( email)), new Update().set("email", email), Account.class);

    The new document will be like {"_id":"some_id",email:"[email protected]"}. Is it normal?

    I understand that I can use new Update().set("email", email).set(DefaultMongoTypeMapper.DEFAULT_TYPE_KEY , Account.class.getName()).
Working...
X