Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(createCollection): Db.createCollection should pass readConcern to new collection #2026

Merged
merged 13 commits into from
Jun 21, 2019
3 changes: 2 additions & 1 deletion lib/operations/create_collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ const illegalCommandFields = [
'raw',
'readPreference',
'session',
'readConcern'
'readConcern',
'writeConcern'
];

class CreateCollectionOperation extends CommandOperation {
Expand Down
20 changes: 10 additions & 10 deletions test/functional/readconcern_tests.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,21 +64,21 @@ describe('ReadConcern', function() {
const configuration = this.configuration;
const client = configuration.newClient(
{ w: 1 },
{ poolSize: 1, readConcern: { level: 'local' }, monitorCommands: true }
{ poolSize: 1, readConcern: { level: 'local' } }
);

client.connect(function(err, client) {
client.connect((err, client) => {
expect(err).to.not.exist;

const db = client.db(configuration.db);
test.deepEqual({ level: 'local' }, db.s.readConcern);
expect(db.s.readConcern).to.deep.equal({ level: 'local' });

// Get a collection using createCollection
const collection = db.createCollection('readConcernCollection');
// Validate readConcern
expect(test).to.deep.equal({ level: 'local' }, collection.s.readConcern);
client.close();
done();
db.createCollection('readConcernCollection', (err, collection) => {
console.log('err: ', err);
rosemaryy marked this conversation as resolved.
Show resolved Hide resolved
console.log('collection: ', collection);
// Validate readConcern
expect(collection.s.readConcern).to.deep.equal({ level: 'local' });
client.close(done);
});
});
}
});
Expand Down