File tree Expand file tree Collapse file tree 1 file changed +2
-2
lines changed
Expand file tree Collapse file tree 1 file changed +2
-2
lines changed Original file line number Diff line number Diff line change @@ -61,7 +61,7 @@ export function setupMongoMetrics(client: MongoClient): void {
6161 * e.g., { find: "users" } -> collection is "users"
6262 */
6363 // eslint-disable-next-line @typescript-eslint/no-explicit-any
64- const collection = ( event . command as any ) [ event . commandName ] || 'unknown' ;
64+ const collection = event . command ? ( ( event . command as any ) [ event . commandName ] || 'unknown' ) : 'unknown' ;
6565 const db = event . databaseName || 'unknown' ;
6666
6767 mongoCommandDuration
@@ -88,7 +88,7 @@ export function setupMongoMetrics(client: MongoClient): void {
8888 * e.g., { find: "users" } -> collection is "users"
8989 */
9090 // eslint-disable-next-line @typescript-eslint/no-explicit-any
91- const collection = ( event . command as any ) [ event . commandName ] || 'unknown' ;
91+ const collection = event . command ? ( ( event . command as any ) [ event . commandName ] || 'unknown' ) : 'unknown' ;
9292 const db = event . databaseName || 'unknown' ;
9393
9494 mongoCommandDuration
You can’t perform that action at this time.
0 commit comments