UNPKG

axiodb

Version:

The Pure JavaScript Alternative to SQLite. Embedded NoSQL database for Node.js with MongoDB-style queries, zero native dependencies, built-in InMemoryCache, and web GUI. Perfect for desktop apps, CLI tools, and embedded systems. No compilation, no platfor

56 lines (55 loc) 1.55 kB
import { AxioDBCloud } from './AxioDBCloud.client'; import ReaderProxy from './ReaderProxy'; import UpdateOperationProxy from './UpdateOperationProxy'; import DeleteOperationProxy from './DeleteOperationProxy'; import AggregationProxy from './AggregationProxy'; /** * Collection Proxy - Remote proxy for Collection operations * Mirrors the Collection class API */ export default class CollectionProxy { private client; private dbName; private collectionName; constructor(client: AxioDBCloud, dbName: string, collectionName: string); /** * Insert a single document */ insert(data: object): Promise<any>; /** * Insert many documents */ insertMany(documents: object[]): Promise<any>; /** * Query documents - returns a query builder */ query(query: object): ReaderProxy; /** * Update documents - returns an update operation builder */ update(query: object): UpdateOperationProxy; /** * Delete documents - returns a delete operation builder */ delete(query: object): DeleteOperationProxy; /** * Aggregate - returns an aggregation builder */ aggregate(pipeline: object[]): AggregationProxy; /** * Get total document count */ totalDocuments(): Promise<any>; /** * Create index on fields */ newIndex(...fieldNames: string[]): Promise<any>; /** * Drop an index */ dropIndex(indexName: string): Promise<any>; /** * Get collection name */ get name(): string; }