File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed
test/functional/com/mongodb Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -576,7 +576,7 @@ public DBCursor skip(final int numberOfElements) {
576576
577577 @ Override
578578 public long getCursorId () {
579- if (cursor != null ) {
579+ if (cursor != null && cursor . getServerCursor () != null ) {
580580 return cursor .getServerCursor ().getId ();
581581 } else {
582582 return 0 ;
Original file line number Diff line number Diff line change @@ -210,6 +210,11 @@ public void testGetCursorId() {
210210 assertEquals (0 , cursor .getCursorId ());
211211 cursor .hasNext ();
212212 assertThat (cursor .getCursorId (), is (not (0L )));
213+
214+ cursor = collection .find ();
215+ assertEquals (0 , cursor .getCursorId ());
216+ cursor .hasNext ();
217+ assertThat (cursor .getCursorId (), is (0L ));
213218 }
214219
215220 @ Test
You can’t perform that action at this time.
0 commit comments