Esempio n. 1
0
 public Todo update(String todoId, String body) {
   Todo todo = new Gson().fromJson(body, Todo.class);
   collection.update(
       new BasicDBObject("_id", new ObjectId(todoId)),
       new BasicDBObject("$set", new BasicDBObject("done", todo.isDone())));
   return this.find(todoId);
 }
Esempio n. 2
0
 public void createNewTodo(String body) {
   Todo todo = new Gson().fromJson(body, Todo.class);
   collection.insert(
       new BasicDBObject("title", todo.getTitle())
           .append("done", todo.isDone())
           .append("createdOn", new Date()));
 }