afriday
Apr 25th, 2011, 11:26 PM
i want to do $ne operation, but i have not found a criteria match it.
and the in ,nin seems working incorrectly, i insert 4 persons
Person p1 = new Person("Bob", 33);
mongoTemplate.insert(p1);
Person p2 = new Person("Mary", 25);
mongoTemplate.insert(p2);
Person p3 = new Person("Chris", 68);
mongoTemplate.insert(p3);
Person p4 = new Person("Janet", 29);
mongoTemplate.insert(p4);
when i use in operation, it print none
List l = Arrays.asList(25);
List<Person> ps = mongoTemplate.find(new Query(where("age").in(l)), Person.class);
for(Person s : ps) {
System.out.println(s);
}
and when i use nin operation, it print the all persons
thank you for help!
and the in ,nin seems working incorrectly, i insert 4 persons
Person p1 = new Person("Bob", 33);
mongoTemplate.insert(p1);
Person p2 = new Person("Mary", 25);
mongoTemplate.insert(p2);
Person p3 = new Person("Chris", 68);
mongoTemplate.insert(p3);
Person p4 = new Person("Janet", 29);
mongoTemplate.insert(p4);
when i use in operation, it print none
List l = Arrays.asList(25);
List<Person> ps = mongoTemplate.find(new Query(where("age").in(l)), Person.class);
for(Person s : ps) {
System.out.println(s);
}
and when i use nin operation, it print the all persons
thank you for help!