Skip to content

Commit 617a5bd

Browse files
author
Divjot Arora
committed
Add BatchCursorFromCursor method
GODRIVER-1163 Change-Id: I196e71f84532eb7a4203f84a7b16d67e9541bfa9
1 parent fa7f710 commit 617a5bd

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

mongo/cursor.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import (
1515
"go.mongodb.org/mongo-driver/bson"
1616
"go.mongodb.org/mongo-driver/bson/bsoncodec"
1717
"go.mongodb.org/mongo-driver/x/bsonx/bsoncore"
18+
"go.mongodb.org/mongo-driver/x/mongo/driver"
1819
"go.mongodb.org/mongo-driver/x/mongo/driver/session"
1920
"go.mongodb.org/mongo-driver/x/mongo/driverlegacy"
2021
)
@@ -223,3 +224,10 @@ func (c *Cursor) closeImplicitSession() {
223224
c.clientSession.EndSession()
224225
}
225226
}
227+
228+
// BatchCursorFromCursor returns a driver.BatchCursor for the given Cursor. If there is no underlying driver.BatchCursor,
229+
// nil is returned. This method is deprecated and does not have any stability guarantees. It may be removed in the future.
230+
func BatchCursorFromCursor(c *Cursor) *driver.BatchCursor {
231+
bc, _ := c.bc.(*driver.BatchCursor)
232+
return bc
233+
}

0 commit comments

Comments
 (0)