diff --git a/src/long.ts b/src/long.ts index afd5005a..0d059e25 100644 --- a/src/long.ts +++ b/src/long.ts @@ -994,7 +994,7 @@ export class Long { } inspect(): string { - return `new Long("${this.toString()}")`; + return `Long.fromString("${this.toString()}"${this.unsigned ? ', true' : ''})`; } } diff --git a/test/node/bson_test.js b/test/node/bson_test.js index 306cc940..56c246d9 100644 --- a/test/node/bson_test.js +++ b/test/node/bson_test.js @@ -2356,7 +2356,10 @@ describe('BSON', function () { */ it('Long', function () { const long = Long.fromString('42'); - expect(inspect(long)).to.equal('new Long("42")'); + expect(inspect(long)).to.equal('Long.fromString("42")'); + + const unsignedLong = Long.fromString('42', true); + expect(inspect(unsignedLong)).to.equal('Long.fromString("42", true)'); }); /**