コード例 #1
0
  @Override
  public void updateWordFoundIn(String word, File file) {
    Query query = new Query();
    query.addCriteria(Criteria.where("name").is(word));

    Update update = new Update();
    update.addToSet("foundIn", file);

    mongo.upsert(query, update, Word.class);
  }
コード例 #2
0
  public void Add(PackageInfo pi, PackageNode pn) {

    if (pi != null && pn != null) {
      Query query = new Query();
      // _id = idPaquete
      query.addCriteria(
          Criteria.where("_id").is(pi.getIdPaquete()).and("idCliente").is(pi.getIdCliente()));
      Update update = new Update();
      update.push("nodes", pn);

      mongoOperations.upsert(query, update, PackageInfo.class);
    }
  }