Skip to content
Merged
Changes from all 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
24 changes: 14 additions & 10 deletions packages/shell-api/src/collection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1348,18 +1348,22 @@ export default class Collection extends ShellApiWithMongoClass {

// @ts-expect-error waiting for driver release
if (!encryptedFields && !options.encryptedFields) {
const collectionInfos = await this._mongo._serviceProvider.listCollections(
this._database._name,
{
name: this._name
},
await this._database._baseOptions()
);
try {
const collectionInfos = await this._mongo._serviceProvider.listCollections(
this._database._name,
{
name: this._name
},
await this._database._baseOptions()
);

const encryptedFields: Document | undefined = collectionInfos?.[0]?.options?.encryptedFields;
const encryptedFields: Document | undefined = collectionInfos?.[0]?.options?.encryptedFields;

if (encryptedFields) {
encryptedFieldsOptions = { encryptedFields };
if (encryptedFields) {
encryptedFieldsOptions = { encryptedFields };
}
} catch (error) {
// pass, ignore all error messages
}
}

Expand Down