Skip to content

Commit 80556b3

Browse files
committed
JAVA-2831: Don't send batch size of 0 for listCollections or listIndexes
1 parent 94744ee commit 80556b3

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

driver-core/src/main/com/mongodb/operation/ListCollectionsOperation.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ private MongoNamespace getNamespace() {
270270

271271
private BsonDocument getCommand() {
272272
BsonDocument command = new BsonDocument("listCollections", new BsonInt32(1))
273-
.append("cursor", getCursorDocumentFromBatchSize(batchSize));
273+
.append("cursor", getCursorDocumentFromBatchSize(batchSize == 0 ? null : batchSize));
274274
if (filter != null) {
275275
command.append("filter", filter);
276276
}

driver-core/src/main/com/mongodb/operation/ListIndexesOperation.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ private MongoNamespace getIndexNamespace() {
226226

227227
private BsonDocument getCommand() {
228228
BsonDocument command = new BsonDocument("listIndexes", new BsonString(namespace.getCollectionName()))
229-
.append("cursor", getCursorDocumentFromBatchSize(batchSize));
229+
.append("cursor", getCursorDocumentFromBatchSize(batchSize == 0 ? null : batchSize));
230230
if (maxTimeMS > 0) {
231231
command.put("maxTimeMS", new BsonInt64(maxTimeMS));
232232
}

0 commit comments

Comments
 (0)