Package org.springframework.data.mongodb.core.query

Examples of org.springframework.data.mongodb.core.query.Criteria


    template.save(p1);
    PersonWithObjectId p2 = new PersonWithObjectId(2, "second", "");
    template.save(p2);

    List<PersonWithObjectId> results = template.find(
        new Query(new Criteria().orOperator(where("ssn").is(1), where("ssn").is(2))), PersonWithObjectId.class);

    assertNotNull(results);
    assertThat(results.size(), is(2));
    assertThat(results.get(1).getSsn(), is(2));
  }
View Full Code Here


    template.save(p1);
    PersonWithObjectId p2 = new PersonWithObjectId(2, "second", "");
    template.save(p2);

    List<PersonWithObjectId> results = template.find(
        new Query(new Criteria().orOperator(where("ssn").is(1), where("ssn").is(2))), PersonWithObjectId.class);

    assertNotNull(results);
    assertThat(results.size(), is(2));
    assertThat(results.get(1).getSsn(), is(2));
  }
View Full Code Here

    PersonWithIdPropertyOfTypeObjectId p4 = new PersonWithIdPropertyOfTypeObjectId();
    p4.setFirstName("John");
    p4.setAge(41);
    template.insert(p4);

    Query orQuery = new Query(new Criteria().orOperator(where("age").in(11, 21), where("age").is(31)));
    List<PersonWithIdPropertyOfTypeObjectId> results = template.find(orQuery, PersonWithIdPropertyOfTypeObjectId.class);
    assertThat(results.size(), is(3));
    for (PersonWithIdPropertyOfTypeObjectId p : results) {
      assertThat(p.getAge(), isOneOf(11, 21, 31));
    }
View Full Code Here

TOP

Related Classes of org.springframework.data.mongodb.core.query.Criteria

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.