Skip to content

Commit 0902172

Browse files
committed
fix: ns is not a required field
1 parent 9f80b5b commit 0902172

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/cmap/wire_protocol/responses.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ export class CursorResponse extends MongoDBResponse {
190190
}
191191

192192
public id: Long;
193-
public ns: MongoDBNamespace;
193+
public ns: MongoDBNamespace | null = null;
194194
public batchSize = 0;
195195

196196
private batch: OnDemandDocument;
@@ -204,8 +204,8 @@ export class CursorResponse extends MongoDBResponse {
204204
const id = cursor.get('id', BSONType.long, true);
205205
this.id = new Long(Number(id & 0xffff_ffffn), Number((id >> 32n) & 0xffff_ffffn));
206206

207-
const namespace = cursor.get('ns', BSONType.string) ?? '';
208-
if (namespace) this.ns = ns(namespace);
207+
const namespace = cursor.get('ns', BSONType.string);
208+
if (namespace != null) this.ns = ns(namespace);
209209

210210
if (cursor.has('firstBatch')) this.batch = cursor.get('firstBatch', BSONType.array, true);
211211
else if (cursor.has('nextBatch')) this.batch = cursor.get('nextBatch', BSONType.array, true);

0 commit comments

Comments
 (0)