Skip to content

Commit 5738e67

Browse files
contribution from Zoramite from python driver
1 parent 0939202 commit 5738e67

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

src/test/com/mongodb/DBCursorTest.java

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -240,14 +240,18 @@ public void testSpecial(){
240240

241241
}
242242

243-
// @Test
244-
// public void testFullRangeCursorIdsOnClose(){
245-
// DBCollection c = _db.getCollection( "testCursorIds" );
246-
// c.insert( new BasicDBObject( "x" , 1 ) );
247-
//
248-
// DBCursor curr
249-
//
250-
// }
243+
@Test
244+
public void testUpsert(){
245+
DBCollection c = _db.getCollection( "upsert1" );
246+
c.drop();
247+
248+
c.update( new BasicDBObject( "page" , "/" ), new BasicDBObject( "$inc" , new BasicDBObject( "count" , 1 ) ), true, false );
249+
c.update( new BasicDBObject( "page" , "/" ), new BasicDBObject( "$inc" , new BasicDBObject( "count" , 1 ) ), true, false );
250+
251+
assertEquals( 1, c.getCount() );
252+
assertEquals( 2, c.findOne().get( "count" ) );
253+
}
254+
251255
@Test
252256
public void testLimitAndBatchSize() {
253257
DBCollection c = _db.getCollection( "LimitAndBatchSize" );

0 commit comments

Comments
 (0)