Examples of notNew()


Examples of org.bson.types.ObjectId.notNew()

    @Test
    public void canInsertAPojoWithNotNewObjectId() throws Exception {

        ObjectId id = ObjectId.get();
        id.notNew();

        collection.withWriteConcern(WriteConcern.SAFE).insert(new Friend(id, "John"));

        Friend result = collection.findOne(id).as(Friend.class);
        assertThat(result.getId()).isEqualTo(id);
View Full Code Here

Examples of org.bson.types.ObjectId.notNew()

    @Test
    public void canOnlyInsertOnceAPojoWithObjectId() throws Exception {

        ObjectId id = ObjectId.get();
        id.notNew();

        collection.withWriteConcern(WriteConcern.SAFE).insert(new Friend(id, "John"));

        try {
            collection.withWriteConcern(WriteConcern.SAFE).insert(new Friend(id, "John"));
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.