fix: GridFS file storage doesn't work with certain enableSchemaHooks settings (#8467)
This commit is contained in:
@@ -55,6 +55,8 @@ describe('FilesController', () => {
|
||||
const config = Config.get(Parse.applicationId);
|
||||
expect(config.database.adapter._mongoOptions.retryWrites).toBeTrue();
|
||||
expect(config.filesController.adapter._mongoOptions.retryWrites).toBeTrue();
|
||||
expect(config.filesController.adapter._mongoOptions.enableSchemaHooks).toBeUndefined();
|
||||
expect(config.filesController.adapter._mongoOptions.schemaCacheTtl).toBeUndefined();
|
||||
});
|
||||
|
||||
it('should create a server log on failure', done => {
|
||||
|
||||
@@ -20,6 +20,22 @@ describe_only_db('mongo')('GridFSBucket', () => {
|
||||
await db.dropDatabase();
|
||||
});
|
||||
|
||||
it('should connect to mongo with the supported database options', async () => {
|
||||
const databaseURI = 'mongodb://localhost:27017/parse';
|
||||
const gfsAdapter = new GridFSBucketAdapter(databaseURI, {
|
||||
retryWrites: true,
|
||||
// these are not supported by the mongo client
|
||||
enableSchemaHooks: true,
|
||||
schemaCacheTtl: 5000,
|
||||
maxTimeMS: 30000,
|
||||
});
|
||||
|
||||
const db = await gfsAdapter._connect();
|
||||
const status = await db.admin().serverStatus();
|
||||
expect(status.connections.current > 0).toEqual(true);
|
||||
expect(db.options?.retryWrites).toEqual(true);
|
||||
});
|
||||
|
||||
it('should save an encrypted file that can only be decrypted by a GridFS adapter with the encryptionKey', async () => {
|
||||
const unencryptedAdapter = new GridFSBucketAdapter(databaseURI);
|
||||
const encryptedAdapter = new GridFSBucketAdapter(
|
||||
|
||||
Reference in New Issue
Block a user