Skip to content
This repository was archived by the owner on May 17, 2021. It is now read-only.

Commit e720022

Browse files
authored
COMPASS-4353 - Do not report bogus readonly key from collectionStats (#256)
`collStats` does not provide the `readonly` information, so don’t make up a possibly incorrect value and instead omit the key.
1 parent 3ae9f56 commit e720022

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

lib/native-client.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ class NativeClient extends EventEmitter {
381381
this._buildCollectionStats(
382382
databaseName,
383383
collectionName,
384-
data || { readonly: true }
384+
data || {}
385385
)
386386
);
387387
});
@@ -1031,7 +1031,6 @@ class NativeClient extends EventEmitter {
10311031
size: data.size,
10321032
index_details: data.indexDetails || {},
10331033
wired_tiger: data.wiredTiger || {},
1034-
readonly: data.readonly || false
10351034
};
10361035
}
10371036

test/native-client.test.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,19 @@ describe('NativeClient', function() {
406406
done();
407407
});
408408
});
409+
410+
// collectionStats() used to provide a `readonly: <boolean>` key, but
411+
// since the underlying database command does not provide one, the value
412+
// was bogus. Make sure that we're not accidentally providing an incorrect
413+
// value.
414+
it('does not provide a readonly key', function(done) {
415+
client.collectionStats('data-service', 'test', function(err, stats) {
416+
assert.equal(null, err);
417+
expect(stats.name).to.equal('test');
418+
expect(Object.keys(stats)).to.not.include('readonly');
419+
done();
420+
});
421+
});
409422
});
410423
});
411424

0 commit comments

Comments
 (0)