ruvnet/ruflo · error

aggregate() called — basic translation only

Error message

aggregate() called — basic translation only

What it means

Log warning in the Postgres collection's aggregate: MongoDB-style aggregation pipelines are only partially translated to SQL, so complex/untranslatable stages are approximated or ignored — callers must not rely on full aggregation semantics.

Source

Thrown at ruflo/src/ruvocal/src/lib/server/database/postgres.ts:481

		return result.rows[0]?.count ?? 0;
	}

	async distinct(
		field: string,
		filter: Record<string, unknown> = {}
	): Promise<unknown[]> {
		const col = `"${snakeCase(field)}"`;
		const w = filterToWhere(filter);
		const sql = `SELECT DISTINCT ${col} FROM "${this.tableName}" WHERE ${w.text}`;
		const result = await this.pool.query(sql, w.values);
		return result.rows.map((r) => r[snakeCase(field)]);
	}

	async aggregate(pipeline: Record<string, unknown>[]): Promise<T[]> {
		// Basic aggregation support — handle common patterns
		// For complex pipelines, we'd need a full translator.
		// For now, log a warning and return empty.
		logger.warn(
			{ pipeline, table: this.tableName },
			"aggregate() called — basic translation only"
		);
		return [];
	}

	async createIndex(
		_spec: Record<string, unknown>,
		_options?: Record<string, unknown>
	): Promise<void> {
		// Indexes are pre-created in the migration. This is a no-op.
	}

	async findOneAndUpdate(
		filter: Record<string, unknown>,
		update: Record<string, unknown>,
		options?: { upsert?: boolean; returnDocument?: "before" | "after" }
	): Promise<{ value: T | null }> {

View on GitHub (pinned to fa13ee4ad6)

Solutions

  1. Avoid aggregate() on this adapter, or extend the translation layer to support the aggregation pipeline stages used.
Defensive patterns

Strategy: fallback

When it happens

Trigger: Thrown at ruflo/src/ruvocal/src/lib/server/database/postgres.ts:481 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of ruvnet/ruflo@fa13ee4ad6 (2026-08-18). Data as JSON: /api/errors/d751417f18e9363c. Report an issue: GitHub.