UNPKG

@andrejs1979/document

Version:

MongoDB-compatible document database for NoSQL

109 lines 2.94 kB
/** * NoSQL - MongoDB-Compatible Query Engine * Advanced query processing with optimization and indexing */ import { Document, QueryFilter, FindOptions, AggregationPipeline, AggregationOptions, QueryExplain, QueryMetrics } from '../types'; /** * Query engine for MongoDB-compatible operations */ export declare class MongoQueryEngine { private d1; private indexManager; private queryMetrics; constructor(d1: any, indexManager: any); /** * Build SQL query from MongoDB filter */ buildQuery(database: string, collection: string, filter: QueryFilter, options?: FindOptions): { sql: string; params: any[]; explanation: string; }; /** * Build filter conditions from MongoDB query */ private buildFilterConditions; /** * Handle logical operators ($and, $or, $not, etc.) */ private handleLogicalOperator; /** * Handle field-level filters */ private handleFieldFilter; /** * Handle field operators ($eq, $ne, $gt, etc.) */ private handleFieldOperator; /** * Handle text search */ private handleTextSearch; /** * Handle vector search */ private handleVectorSearch; /** * Handle hybrid search (text + vector) */ private handleHybridSearch; /** * Build ORDER BY clause */ private buildOrderBy; /** * Build projection (field selection) */ private buildProjection; /** * Get field reference (indexed column or JSON extract) */ private getFieldReference; /** * Get indexed column for field (if available) */ private getIndexColumn; /** * Get type check SQL */ private getTypeCheck; /** * Convert regex to SQL LIKE pattern (simplified) */ private convertRegexToLike; /** * Execute aggregation pipeline */ executeAggregation(database: string, collection: string, pipeline: AggregationPipeline, options?: AggregationOptions): Promise<Document[]>; /** * Process single aggregation stage */ private processAggregationStage; private stageMatch; private stageProject; private stageGroup; private stageSort; private stageLimit; private stageSkip; private stageUnwind; private stageLookup; private stageAddFields; private stageSample; private matchesFilter; private applyProjection; private evaluateExpression; private applyGroupOperation; private getFieldValue; private setFieldValue; private recordQueryMetrics; private generateQueryId; /** * Get query performance metrics */ getQueryMetrics(): QueryMetrics[]; /** * Explain query execution plan */ explainQuery(database: string, collection: string, filter: QueryFilter, options?: FindOptions): Promise<QueryExplain>; } //# sourceMappingURL=query-engine.d.ts.map