0

I can't find an API for this simple operation. What I need to do is insert a new document if it doesn't exist already, so I'm trying to use "upsert":

JacksonDBCollection<User, String> collection = 
    JacksonDBCollection.wrap(database.getCollection("users"), 
            User.class, String.class);
collection.ensureIndex("email");
collection.update(DBQuery.in("email", user.email),
    <what should I put here?>, true, false);

The object I need to insert is "user", but update() signature accepts only DBQuery instance.

Thanks, Michael

Michael Spector
  • 36,723
  • 6
  • 60
  • 88

0 Answers0