---
title: Driver Nosql
description: Driver Nosql protocol schemas
---

{/* ⚠️  AUTO-GENERATED — DO NOT EDIT. Run build-docs.ts to regenerate. Hand-written docs go in content/docs/guides/. */}

NoSQL Database Type Enumeration

Supported NoSQL database types

<Callout type="info">
**Source:** `packages/spec/src/data/driver-nosql.zod.ts`
</Callout>

## TypeScript Usage

```typescript
import { AggregationPipeline, AggregationStage, ConsistencyLevel, DocumentValidationSchema, NoSQLDataTypeMapping, NoSQLDatabaseType, NoSQLDriverConfig, NoSQLIndex, NoSQLIndexType, NoSQLOperationType, NoSQLQueryOptions, NoSQLTransactionOptions, ReplicationConfig, ShardingConfig } from '@objectstack/spec/data';
import type { AggregationPipeline, AggregationStage, ConsistencyLevel, DocumentValidation, NoSQLDataTypeMapping, NoSQLDatabaseType, NoSQLDriverConfig, NoSQLIndex, NoSQLIndexType, NoSQLOperationType, NoSQLQueryOptions, NoSQLTransactionOptions, ReplicationConfig, ShardingConfig } from '@objectstack/spec/data';

// Validate data
const result = AggregationPipeline.parse(data);
```

---

## AggregationPipeline

### Properties

| Property | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| **collection** | `string` | ✅ | Collection/table name |
| **stages** | `Object[]` | ✅ | Aggregation pipeline stages |
| **options** | `Object` | optional | Query options |


---

## AggregationStage

### Properties

| Property | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| **operator** | `string` | ✅ | Aggregation operator (e.g., $match, $group, $sort) |
| **options** | `Record<string, any>` | ✅ | Stage-specific options |


---

## ConsistencyLevel

### Allowed Values

* `all`
* `quorum`
* `one`
* `local_quorum`
* `each_quorum`
* `eventual`


---

## DocumentValidationSchema

### Properties

| Property | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| **enabled** | `boolean` | ✅ | Enable schema validation |
| **validationLevel** | `Enum<'strict' \| 'moderate' \| 'off'>` | optional | Validation strictness |
| **validationAction** | `Enum<'error' \| 'warn'>` | optional | Action on validation failure |
| **jsonSchema** | `Record<string, any>` | optional | JSON Schema for validation |


---

## NoSQLDataTypeMapping

### Properties

| Property | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| **text** | `string` | ✅ | NoSQL type for text fields |
| **number** | `string` | ✅ | NoSQL type for number fields |
| **boolean** | `string` | ✅ | NoSQL type for boolean fields |
| **date** | `string` | ✅ | NoSQL type for date fields |
| **datetime** | `string` | ✅ | NoSQL type for datetime fields |
| **json** | `string` | optional | NoSQL type for JSON/object fields |
| **uuid** | `string` | optional | NoSQL type for UUID fields |
| **binary** | `string` | optional | NoSQL type for binary fields |
| **array** | `string` | optional | NoSQL type for array fields |
| **objectId** | `string` | optional | NoSQL type for ObjectID fields (MongoDB) |
| **geopoint** | `string` | optional | NoSQL type for geospatial point fields |


---

## NoSQLDatabaseType

### Allowed Values

* `mongodb`
* `couchdb`
* `dynamodb`
* `cassandra`
* `redis`
* `elasticsearch`
* `neo4j`
* `orientdb`


---

## NoSQLDriverConfig

### Properties

| Property | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| **name** | `string` | ✅ | Driver instance name |
| **type** | `string` | ✅ | Driver type must be "nosql" |
| **capabilities** | `Object` | ✅ | Driver capability flags |
| **connectionString** | `string` | optional | Database connection string (driver-specific format) |
| **poolConfig** | `Object` | optional | Connection pool configuration |
| **databaseType** | `Enum<'mongodb' \| 'couchdb' \| 'dynamodb' \| 'cassandra' \| 'redis' \| 'elasticsearch' \| 'neo4j' \| 'orientdb'>` | ✅ | Specific NoSQL database type |
| **dataTypeMapping** | `Object` | ✅ | NoSQL data type mapping configuration |
| **consistency** | `Enum<'all' \| 'quorum' \| 'one' \| 'local_quorum' \| 'each_quorum' \| 'eventual'>` | optional | Consistency level for operations |
| **replication** | `Object` | optional | Replication configuration |
| **sharding** | `Object` | optional | Sharding configuration |
| **schemaValidation** | `Object` | optional | Document schema validation |
| **region** | `string` | optional | AWS region (for managed NoSQL services) |
| **accessKeyId** | `string` | optional | AWS access key ID |
| **secretAccessKey** | `string` | optional | AWS secret access key |
| **ttlField** | `string` | optional | Field name for TTL (auto-deletion) |
| **maxDocumentSize** | `integer` | optional | Maximum document size in bytes |
| **collectionPrefix** | `string` | optional | Prefix for collection/table names |


---

## NoSQLIndex

### Properties

| Property | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| **name** | `string` | ✅ | Index name |
| **type** | `Enum<'single' \| 'compound' \| 'unique' \| 'text' \| 'geospatial' \| 'hashed' \| 'ttl' \| 'sparse'>` | ✅ | Index type |
| **fields** | `Object[]` | ✅ | Fields to index |
| **unique** | `boolean` | ✅ | Enforce uniqueness |
| **sparse** | `boolean` | ✅ | Sparse index |
| **expireAfterSeconds** | `integer` | optional | TTL in seconds |
| **partialFilterExpression** | `Record<string, any>` | optional | Partial index filter |
| **background** | `boolean` | ✅ | Create index in background |


---

## NoSQLIndexType

### Allowed Values

* `single`
* `compound`
* `unique`
* `text`
* `geospatial`
* `hashed`
* `ttl`
* `sparse`


---

## NoSQLOperationType

### Allowed Values

* `find`
* `findOne`
* `insert`
* `update`
* `delete`
* `aggregate`
* `mapReduce`
* `count`
* `distinct`
* `createIndex`
* `dropIndex`


---

## NoSQLQueryOptions

### Properties

| Property | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| **consistency** | `Enum<'all' \| 'quorum' \| 'one' \| 'local_quorum' \| 'each_quorum' \| 'eventual'>` | optional | Consistency level override |
| **readFromSecondary** | `boolean` | optional | Allow reading from secondary replicas |
| **projection** | `Record<string, number \| number>` | optional | Field projection |
| **timeout** | `integer` | optional | Query timeout (ms) |
| **useCursor** | `boolean` | optional | Use cursor instead of loading all results |
| **batchSize** | `integer` | optional | Cursor batch size |
| **profile** | `boolean` | optional | Enable query profiling |
| **hint** | `string` | optional | Index hint for query optimization |


---

## NoSQLTransactionOptions

### Properties

| Property | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| **readConcern** | `Enum<'local' \| 'majority' \| 'linearizable' \| 'snapshot'>` | optional | Read concern level |
| **writeConcern** | `Enum<'majority' \| 'acknowledged' \| 'unacknowledged'>` | optional | Write concern level |
| **readPreference** | `Enum<'primary' \| 'primaryPreferred' \| 'secondary' \| 'secondaryPreferred' \| 'nearest'>` | optional | Read preference |
| **maxCommitTimeMS** | `integer` | optional | Transaction commit timeout (ms) |


---

## ReplicationConfig

### Properties

| Property | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| **enabled** | `boolean` | ✅ | Enable replication |
| **replicaSetName** | `string` | optional | Replica set name |
| **replicas** | `integer` | optional | Number of replicas |
| **readPreference** | `Enum<'primary' \| 'primaryPreferred' \| 'secondary' \| 'secondaryPreferred' \| 'nearest'>` | optional | Read preference for replica set |
| **writeConcern** | `Enum<'majority' \| 'acknowledged' \| 'unacknowledged'>` | optional | Write concern level |


---

## ShardingConfig

### Properties

| Property | Type | Required | Description |
| :--- | :--- | :--- | :--- |
| **enabled** | `boolean` | ✅ | Enable sharding |
| **shardKey** | `string` | optional | Field to use as shard key |
| **shardingStrategy** | `Enum<'hash' \| 'range' \| 'zone'>` | optional | Sharding strategy |
| **numShards** | `integer` | optional | Number of shards |


---

