open-index/open-npm huggingface dataset:
npm package: @objectql/driver-mongo
Description: MongoDB driver for ObjectQL - Native aggregation pipeline translation for high-performance NoSQL operations
Latest version: 4.2.2

# @objectql/driver-mongo

MongoDB driver for ObjectQL. Supports basic CRUD, filtering, and aggregation pipelines on MongoDB.

**Now with ObjectStack QueryAST support!** This driver implements both the legacy `Driver` interface and the new `DriverInterface` from `@objectstack/spec` for seamless integration with the ObjectStack ecosystem.

## Installation

```bash
npm install @objectql/driver-mongo
```

## Usage

```typescript
import { MongoDriver } from '@objectql/driver-mongo';

const driver = new MongoDriver({
    url: 'mongodb://localhost:27017',
    dbName: 'my_app'
});

const objectql = new ObjectQL({
    datasources: {
        default: driver
    }
});
```

## Features

- ✅ **100% Backward Compatible** - All existing code continues to work
- ✅ **QueryAST Support** - Supports the new `@objectstack/spec` query format
- ✅ **Smart ID Mapping** - Automatic conversion between `id` (API) and `_id` (MongoDB)
- ✅ **Full-Text Search** - MongoDB text search capabilities
- ✅ **Array & JSON Fields** - Native BSON support for complex data types
- ✅ **Aggregation Pipelines** - Native MongoDB aggregation support

## Driver Metadata

```typescript
console.log(driver.name);     // 'MongoDriver'
console.log(driver.version);  // '3.0.1'
console.log(driver.supports); 
// {
//   transactions: true,
//   joins: false,
//   fullTextSearch: true,
//   jsonFields: true,
//   arrayFields: true
// }
```

## QueryAST Format

The driver now supports both legacy and QueryAST formats:

### Legacy Format
```typescript
const results = await driver.find('users', {
    filters: [['age', '>', 18]],
    sort: [['name', 'asc']],
    limit: 10,
    skip: 0
});
```

### QueryAST Format
```typescript
const results = await driver.find('users', {
    filters: [['age', '>', 18]],
    sort: [{ field: 'name', order: 'asc' }],
    top: 10,  // Instead of 'limit'
    skip: 0
});
```

## Migration Guide

See [MIGRATION.md](./MIGRATION.md) for detailed information about the ObjectStack migration and QueryAST format support.

## License

MIT
npm package: @objectql/driver-sql
Description: SQL database driver for ObjectQL - Supports PostgreSQL, MySQL, SQLite via Knex with DriverInterface v4.0 compliance
Latest version: 4.2.2

# @objectql/driver-sql

Knex.js based SQL driver for ObjectQL. Supports PostgreSQL, MySQL, SQLite, and other SQL databases.

**Phase 4 Update**: Now implements the standard `DriverInterface` from `@objectstack/spec` with full backward compatibility.

## Features

- ✅ **ObjectStack Spec Compatible**: Implements `DriverInterface` from `@objectstack/spec`
- ✅ **QueryAST Support**: Supports both legacy UnifiedQuery and new QueryAST formats
- ✅ **Multiple Databases**: PostgreSQL, MySQL, SQLite, and more via Knex
- ✅ **Transactions**: Full transaction support with begin/commit/rollback
- ✅ **Aggregations**: COUNT, SUM, AVG, MIN, MAX with GROUP BY
- ✅ **Schema Management**: Auto-create/update tables from metadata
- ✅ **Introspection**: Discover existing database schemas
- ✅ **100% Backward Compatible**: All existing code continues to work

## Installation

```bash
npm install @objectql/driver-sql
```

## Basic Usage

```typescript
import { SqlDriver } from '@objectql/driver-sql';

const driver = new SqlDriver({
    client: 'sqlite3',
    connection: {
        filename: './data.db'
    },
    useNullAsDefault: true
});

const objectql = new ObjectQL({
    datasources: {
        default: driver
    }
});
```

## QueryAST Format (New)

The driver now supports the QueryAST format from `@objectstack/spec`:

```typescript
// New QueryAST format
const results = await driver.find('users', {
    fields: ['name', 'email'],
    filters: [['active', '=', true]],
    sort: [{ field: 'created_at', order: 'desc' }],
    top: 10,  // Instead of 'limit'
    skip: 0
});

// Aggregations
const stats = await driver.aggregate('orders', {
    aggregations: [
        { function: 'sum', field: 'amount', alias: 'total' },
        { function: 'count', field: '*', alias: 'count' }
    ],
    groupBy: ['customer_id'],
    filters: [['status', '=', 'completed']]
});
```

## Legacy Format (Still Supported)

All existing code continues to work:

```typescript
// Legacy UnifiedQuery format
const results = await driver.find('users', {
    fields: ['name', 'email'],
    filters: [['active', '=', true]],
    sort: [['created_at', 'desc']],
    limit: 10,
    skip: 0
});
```

## Driver Metadata

The driver exposes metadata for ObjectStack compatibility:

```typescript
console.log(driver.name);      // 'SqlDriver'
console.log(driver.version);   // '3.0.1'
console.log(driver.supports);  // { transactions: true, joins: true, ... }
```

## Lifecycle Methods

```typescript
// Connect (optional - connection is automatic)
await driver.connect();

// Check health
const healthy = await driver.checkHealth(); // true/false

// Disconnect
await driver.disconnect();
```

## Migration Guide

See [MIGRATION.md](./MIGRATION.md) for detailed migration information from legacy format to QueryAST format.

## License

MIT