Package org.springframework.data.mongodb.core

Examples of org.springframework.data.mongodb.core.FindAndModifyOptions


    p = mongoTemplate.findOne(queryObj, Person.class);
    assertThat(p.getAge(), is(24));

    // Now return the newly updated document when updating
    p = mongoTemplate.findAndModify(queryObj, updateObj,
        new FindAndModifyOptions().returnNew(true), Person.class);
    assertThat(p.getAge(), is(25));
    // -------------------------------------

    Query queryObj2 = new Query(Criteria.where("name").is("Mary"));
    p = mongoTemplate.findAndModify(
        queryObj2,
        updateObj,
        new FindAndModifyOptions().returnNew(true).upsert(true)
            .remove(false), Person.class);

    assertThat(p.getName(), is("Mary"));
    assertThat(p.getAge(), is(1));
View Full Code Here

TOP

Related Classes of org.springframework.data.mongodb.core.FindAndModifyOptions

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.