Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion spec/GridFSBucketStorageAdapter.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,20 @@ describe_only_db('mongo')('GridFSBucket', () => {
const databaseURI = 'mongodb://localhost:27017/parse';
const gfsAdapter = new GridFSBucketAdapter(databaseURI, {
retryWrites: true,
// these are not supported by the mongo client
// Parse Server-specific options that should be filtered out before passing to MongoDB client
allowPublicExplain: true,
enableSchemaHooks: true,
schemaCacheTtl: 5000,
maxTimeMS: 30000,
disableIndexFieldValidation: true,
logClientEvents: [{ name: 'commandStarted' }],
createIndexUserUsername: true,
createIndexUserUsernameCaseInsensitive: true,
createIndexUserEmail: true,
createIndexUserEmailCaseInsensitive: true,
createIndexUserEmailVerifyToken: true,
createIndexUserPasswordResetToken: true,
createIndexRoleName: true,
});

const db = await gfsAdapter._connect();
Expand Down
16 changes: 15 additions & 1 deletion src/Adapters/Files/GridFSBucketAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,21 @@ export class GridFSBucketAdapter extends FilesAdapter {
const defaultMongoOptions = {
};
const _mongoOptions = Object.assign(defaultMongoOptions, mongoOptions);
for (const key of ['enableSchemaHooks', 'schemaCacheTtl', 'maxTimeMS', 'disableIndexFieldValidation']) {
for (const key of [
'allowPublicExplain',
'enableSchemaHooks',
'schemaCacheTtl',
'maxTimeMS',
'disableIndexFieldValidation',
'logClientEvents',
'createIndexUserUsername',
'createIndexUserUsernameCaseInsensitive',
'createIndexUserEmail',
'createIndexUserEmailCaseInsensitive',
'createIndexUserEmailVerifyToken',
'createIndexUserPasswordResetToken',
'createIndexRoleName',
]) {
delete _mongoOptions[key];
}
this._mongoOptions = _mongoOptions;
Expand Down
4 changes: 2 additions & 2 deletions types/Options/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,15 +230,15 @@ export interface DatabaseOptions {
// Parse Server custom options
enableSchemaHooks?: boolean;
schemaCacheTtl?: number;

allowPublicExplain?: boolean;

// MongoDB driver options
appName?: string;
authMechanism?: string;
authMechanismProperties?: any;
authSource?: string;
autoSelectFamily?: boolean;
autoSelectFamilyAttemptTimeout?: number;
allowPublicExplain?: boolean;
compressors?: string[] | string;
connectTimeoutMS?: number;
directConnection?: boolean;
Expand Down
Loading