Skip to content

Commit 4c0d6a3

Browse files
committed
chore: add clarifying comments
1 parent b253aab commit 4c0d6a3

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/tools/mongodb/read/aggregate.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,10 +174,15 @@ export class AggregateTool extends MongoDBToolBase {
174174
}
175175

176176
for (const stage of pipeline) {
177+
// This validates that in readOnly mode or "write" operations are disabled, we can't use $out or $merge.
178+
// This is really important because aggregates are the only "multi-faceted" tool in the MQL, where you
179+
// can both read and write.
177180
if ((stage.$out || stage.$merge) && writeStageForbiddenError) {
178181
throw new MongoDBError(ErrorCodes.ForbiddenWriteOperation, writeStageForbiddenError);
179182
}
180183

184+
// This ensure that you can't use $vectorSearch if the cluster does not support MongoDB Search
185+
// either in Atlas or in a local cluster.
181186
if (stage.$vectorSearch && !isSearchSupported) {
182187
throw new MongoDBError(
183188
ErrorCodes.AtlasSearchNotSupported,

0 commit comments

Comments
 (0)