ObjectStackObjectStack

Driver Nosql

Driver Nosql protocol schemas

Source: packages/spec/src/data/driver-nosql.zod.ts

TypeScript Usage

import { AggregationPipelineSchema, AggregationStageSchema, ConsistencyLevelSchema, DocumentSchemaValidationSchema, NoSQLDataTypeMappingSchema, NoSQLDatabaseTypeSchema, NoSQLDriverConfigSchema, NoSQLIndexSchema, NoSQLIndexTypeSchema, NoSQLOperationTypeSchema, NoSQLQueryOptionsSchema, NoSQLTransactionOptionsSchema, ReplicationConfigSchema, ShardingConfigSchema } from '@objectstack/spec/data';
import type { AggregationPipeline, AggregationStage, ConsistencyLevel, DocumentSchemaValidation, NoSQLDataTypeMapping, NoSQLDatabaseType, NoSQLDriverConfig, NoSQLIndex, NoSQLIndexType, NoSQLOperationType, NoSQLQueryOptions, NoSQLTransactionOptions, ReplicationConfig, ShardingConfig } from '@objectstack/spec/data';

// Validate data
const result = AggregationPipelineSchema.parse(data);

AggregationPipeline

Properties

PropertyTypeRequiredDescription
collectionstringCollection/table name
stages{ operator: string; options: Record<string, any> }[]Aggregation pipeline stages
options{ consistency?: Enum<'all' | 'quorum' | 'one' | 'local_quorum' | 'each_quorum' | 'eventual'>; readFromSecondary?: boolean; projection?: Record<string, 0 | 1>; timeout?: integer; … }optionalQuery options

Nested Shape: AggregationPipeline.stages[number]

PropertyTypeRequiredDescription
operatorstringAggregation operator (e.g., $match, $group, $sort)
optionsRecord<string, any>Stage-specific options

Nested Shape: AggregationPipeline.options

PropertyTypeRequiredDescription
consistencyEnum<'all' | 'quorum' | 'one' | 'local_quorum' | 'each_quorum' | 'eventual'>optionalConsistency level override
readFromSecondarybooleanoptionalAllow reading from secondary replicas
projectionRecord<string, 0 | 1>optionalField projection
timeoutintegeroptionalQuery timeout (ms)
useCursorbooleanoptionalUse cursor instead of loading all results
batchSizeintegeroptionalCursor batch size
profilebooleanoptionalEnable query profiling
hintstringoptionalIndex hint for query optimization

AggregationStage

Properties

PropertyTypeRequiredDescription
operatorstringAggregation operator (e.g., $match, $group, $sort)
optionsRecord<string, any>Stage-specific options

ConsistencyLevel

Allowed Values

  • all
  • quorum
  • one
  • local_quorum
  • each_quorum
  • eventual

DocumentSchemaValidation

Properties

PropertyTypeRequiredDescription
enabledbooleanoptional (default: false)Enable schema validation
validationLevelEnum<'strict' | 'moderate' | 'off'>optionalValidation strictness
validationActionEnum<'error' | 'warn'>optionalAction on validation failure
jsonSchemaRecord<string, any>optionalJSON Schema for validation

NoSQLDataTypeMapping

Properties

PropertyTypeRequiredDescription
textstringNoSQL type for text fields
numberstringNoSQL type for number fields
booleanstringNoSQL type for boolean fields
datestringNoSQL type for date fields
datetimestringNoSQL type for datetime fields
jsonstringoptionalNoSQL type for JSON/object fields
uuidstringoptionalNoSQL type for UUID fields
binarystringoptionalNoSQL type for binary fields
arraystringoptionalNoSQL type for array fields
objectIdstringoptionalNoSQL type for ObjectID fields (MongoDB)
geopointstringoptionalNoSQL type for geospatial point fields

NoSQLDatabaseType

Allowed Values

  • mongodb
  • couchdb
  • dynamodb
  • cassandra
  • redis
  • elasticsearch
  • neo4j
  • orientdb

NoSQLDriverConfig

Properties

PropertyTypeRequiredDescription
namestringDriver instance name
type'nosql'Driver type must be "nosql"
capabilities{ queryDateGranularity?: Record<string, boolean>; autonumber?: boolean; batchSchemaSync?: boolean }Driver capability flags
connectionStringstringoptionalDatabase connection string (driver-specific format)
poolConfig{ min: number; max: number; idleTimeoutMillis: number; connectionTimeoutMillis: number }optionalConnection pool configuration
databaseTypeEnum<'mongodb' | 'couchdb' | 'dynamodb' | 'cassandra' | 'redis' | 'elasticsearch' | 'neo4j' | 'orientdb'>Specific NoSQL database type
dataTypeMapping{ text: string; number: string; boolean: string; date: string; … }NoSQL data type mapping configuration
consistencyEnum<'all' | 'quorum' | 'one' | 'local_quorum' | 'each_quorum' | 'eventual'>optionalConsistency level for operations
replication{ enabled: boolean; replicaSetName?: string; replicas?: integer; readPreference?: Enum<'primary' | 'primaryPreferred' | 'secondary' | 'secondaryPreferred' | 'nearest'>; … }optionalReplication configuration
sharding{ enabled: boolean; shardKey?: string; shardingStrategy?: Enum<'hash' | 'range' | 'zone'>; numShards?: integer }optionalSharding configuration
schemaValidation{ enabled: boolean; validationLevel?: Enum<'strict' | 'moderate' | 'off'>; validationAction?: Enum<'error' | 'warn'>; jsonSchema?: Record<string, any> }optionalDocument schema validation
regionstringoptionalAWS region (for managed NoSQL services)
accessKeyIdstringoptionalAWS access key ID
secretAccessKeystringoptionalAWS secret access key
ttlFieldstringoptionalField name for TTL (auto-deletion)
maxDocumentSizeintegeroptionalMaximum document size in bytes
collectionPrefixstringoptionalPrefix for collection/table names

Nested Shape: NoSQLDriverConfig.capabilities

PropertyTypeRequiredDescription
queryDateGranularityRecord<string, boolean>optionalPer-granularity native date bucketing (day/week/month/quarter/year). Missing keys fall back to in-memory bucketing.
autonumberbooleanoptionalDriver natively generates persistent autonumber/sequence values
batchSchemaSyncbooleanoptionalSupports batched schema sync to reduce schema DDL round-trips (absence = false)
createneveroptional[REMOVED] DriverCapabilities.create was removed in @objectstack/spec 17.0.0 (ADR-0049 enforce-or-remove) — no code in any repository ever read it, so its value never changed which code path ran. CRUD is not optional for a driver: create/find/findOne/update/delete are REQUIRED IDataDriver methods and the engine calls them unconditionally. Delete the key.
readneveroptional[REMOVED] DriverCapabilities.read was removed in @objectstack/spec 17.0.0 (ADR-0049 enforce-or-remove) — no code in any repository ever read it, so its value never changed which code path ran. CRUD is not optional for a driver: reads go through the REQUIRED find/findOne/count methods, called unconditionally. Delete the key.
updateneveroptional[REMOVED] DriverCapabilities.update was removed in @objectstack/spec 17.0.0 (ADR-0049 enforce-or-remove) — no code in any repository ever read it, so its value never changed which code path ran. CRUD is not optional for a driver: update/upsert are REQUIRED IDataDriver methods, called unconditionally. Delete the key.
deleteneveroptional[REMOVED] DriverCapabilities.delete was removed in @objectstack/spec 17.0.0 (ADR-0049 enforce-or-remove) — no code in any repository ever read it, so its value never changed which code path ran. CRUD is not optional for a driver: delete is a REQUIRED IDataDriver method, called unconditionally. Delete the key.
bulkCreateneveroptional[REMOVED] DriverCapabilities.bulkCreate was removed in @objectstack/spec 17.0.0 (ADR-0049 enforce-or-remove) — no code in any repository ever read it, so its value never changed which code path ran. The bulk methods (bulkCreate/bulkUpdate/bulkDelete) are REQUIRED IDataDriver methods and the engine calls them directly; wire-level batch capability is advertised by REST discovery from the live composition (#3298), never from this record. Delete the key.
bulkUpdateneveroptional[REMOVED] DriverCapabilities.bulkUpdate was removed in @objectstack/spec 17.0.0 (ADR-0049 enforce-or-remove) — no code in any repository ever read it, so its value never changed which code path ran. The bulk methods are REQUIRED IDataDriver methods and the engine calls them directly; wire-level batch capability is advertised by REST discovery from the live composition (#3298), never from this record. Delete the key.
bulkDeleteneveroptional[REMOVED] DriverCapabilities.bulkDelete was removed in @objectstack/spec 17.0.0 (ADR-0049 enforce-or-remove) — no code in any repository ever read it, so its value never changed which code path ran. The bulk methods are REQUIRED IDataDriver methods and the engine calls them directly; wire-level batch capability is advertised by REST discovery from the live composition (#3298), never from this record. Delete the key.
transactionsneveroptional[REMOVED] DriverCapabilities.transactions was removed in @objectstack/spec 17.0.0 (ADR-0049 enforce-or-remove) — no code in any repository ever read it, so its value never changed which code path ran. Transaction use is gated on METHOD PRESENCE — driver.beginTransaction (engine.transaction(), ADR-0034 ambient transactions): a driver without the method gets the non-transactional fallback, whatever this bit claimed. Discovery's transactionalBatch capability is likewise derived from engine.transaction plus the mounted batch route, never from this bit. Delete the key.
savepointsneveroptional[REMOVED] DriverCapabilities.savepoints was removed in @objectstack/spec 17.0.0 (ADR-0049 enforce-or-remove) — no code in any repository ever read it, so its value never changed which code path ran. No savepoint code path exists in the engine — a capability bit for a feature the platform does not call is a false affordance, not documentation. Delete the key.
isolationLevelsneveroptional[REMOVED] DriverCapabilities.isolationLevels was removed in @objectstack/spec 17.0.0 (ADR-0049 enforce-or-remove) — no code in any repository ever read it, so its value never changed which code path ran. Isolation is requested per transaction via beginTransaction({ isolationLevel }); no planner ever consulted this list to decide anything. Delete the key.
queryFiltersneveroptional[REMOVED] DriverCapabilities.queryFilters was removed in @objectstack/spec 17.0.0 (ADR-0049 enforce-or-remove) — no code in any repository ever read it, so its value never changed which code path ran. find() receives the full QueryAST (where/orderBy/limit/offset) and MUST execute all of it — the "ObjectQL will filter in memory" fallback this bit's description promised was never built. Delete the key.
querySortingneveroptional[REMOVED] DriverCapabilities.querySorting was removed in @objectstack/spec 17.0.0 (ADR-0049 enforce-or-remove) — no code in any repository ever read it, so its value never changed which code path ran. find() receives the full QueryAST and MUST execute all of it — the "ObjectQL will sort in memory" fallback this bit's description promised was never built. Delete the key.
queryPaginationneveroptional[REMOVED] DriverCapabilities.queryPagination was removed in @objectstack/spec 17.0.0 (ADR-0049 enforce-or-remove) — no code in any repository ever read it, so its value never changed which code path ran. find() receives the full QueryAST and MUST execute all of it — the "ObjectQL will paginate in memory" fallback this bit's description promised was never built. Delete the key.
queryAggregationsneveroptional[REMOVED] DriverCapabilities.queryAggregations was removed in @objectstack/spec 17.0.0 (ADR-0049 enforce-or-remove) — no code in any repository ever read it, so its value never changed which code path ran. Aggregate pushdown is decided by typeof driver.aggregate === 'function' plus queryDateGranularity (engine aggregate dispatch) — never by this bit. Delete the key.
queryWindowFunctionsneveroptional[REMOVED] DriverCapabilities.queryWindowFunctions was removed in @objectstack/spec 17.0.0 (ADR-0049 enforce-or-remove) — no code in any repository ever read it, so its value never changed which code path ran. ObjectQL never plans window functions through a driver, so there was nothing for the bit to switch on. Delete the key.
querySubqueriesneveroptional[REMOVED] DriverCapabilities.querySubqueries was removed in @objectstack/spec 17.0.0 (ADR-0049 enforce-or-remove) — no code in any repository ever read it, so its value never changed which code path ran. ObjectQL never plans subqueries through a driver, so there was nothing for the bit to switch on. Delete the key.
queryCTEneveroptional[REMOVED] DriverCapabilities.queryCTE was removed in @objectstack/spec 17.0.0 (ADR-0049 enforce-or-remove) — no code in any repository ever read it, so its value never changed which code path ran. ObjectQL never plans Common Table Expressions through a driver, so there was nothing for the bit to switch on. Delete the key.
joinsneveroptional[REMOVED] DriverCapabilities.joins was removed in @objectstack/spec 17.0.0 (ADR-0049 enforce-or-remove) — no code in any repository ever read it, so its value never changed which code path ran. Related data is resolved by the engine (lookup expansion over find()), not by driver-side JOIN planning — no code consulted the bit. Delete the key.
fullTextSearchneveroptional[REMOVED] DriverCapabilities.fullTextSearch was removed in @objectstack/spec 17.0.0 (ADR-0049 enforce-or-remove) — no code in any repository ever read it, so its value never changed which code path ran. $search is compiled by the engine into an $or of $contains predicates over the searchable fields (ADR-0061) and removed from the AST before the driver sees it — no driver-side full-text path exists. Delete the key.
jsonQueryneveroptional[REMOVED] DriverCapabilities.jsonQuery was removed in @objectstack/spec 17.0.0 (ADR-0049 enforce-or-remove) — no code in any repository ever read it, so its value never changed which code path ran. No engine path ever branched on driver-side JSON querying. Delete the key.
geospatialQueryneveroptional[REMOVED] DriverCapabilities.geospatialQuery was removed in @objectstack/spec 17.0.0 (ADR-0049 enforce-or-remove) — no code in any repository ever read it, so its value never changed which code path ran. No geospatial query path exists in the platform — declaring the bit advertised a capability nothing delivers. Delete the key.
streamingneveroptional[REMOVED] DriverCapabilities.streaming was removed in @objectstack/spec 17.0.0 (ADR-0049 enforce-or-remove) — no code in any repository ever read it, and findStream, the only read this bit could describe, was itself removed in 17.0.0: nothing ever called it, and two of its three implementations materialised the entire result set before yielding. The bit carried the same defect one level up (SqlDriver implemented findStream yet declared streaming: false; InMemoryDriver declared true over a full-table read) — which is what zero readers makes inevitable. Page large reads through find() with limit/offset. Delete the key.
jsonFieldsneveroptional[REMOVED] DriverCapabilities.jsonFields was removed in @objectstack/spec 17.0.0 (ADR-0049 enforce-or-remove) — no code in any repository ever read it, so its value never changed which code path ran. Field-type handling is negotiated per object at syncSchema time by the driver itself (e.g. SqlDriver's per-object JSON/date column tracking); no engine path consulted the bit. Delete the key.
arrayFieldsneveroptional[REMOVED] DriverCapabilities.arrayFields was removed in @objectstack/spec 17.0.0 (ADR-0049 enforce-or-remove) — no code in any repository ever read it, so its value never changed which code path ran. Field-type handling is negotiated per object at syncSchema time by the driver itself; no engine path consulted the bit. Delete the key.
vectorSearchneveroptional[REMOVED] DriverCapabilities.vectorSearch was removed in @objectstack/spec 17.0.0 (ADR-0049 enforce-or-remove) — no code in any repository ever read it, so its value never changed which code path ran. No vector read path routes through IDataDriver. When one exists it should arrive WITH its caller and its capability bit together (the honest order under enforce-or-remove), not as a dangling boolean. Delete the key.
schemaSyncneveroptional[REMOVED] DriverCapabilities.schemaSync was removed in @objectstack/spec 17.0.0 (ADR-0049 enforce-or-remove) — no code in any repository ever read it, so its value never changed which code path ran. Schema sync is gated on METHOD PRESENCE — typeof driver.syncSchema === 'function' (engine and ObjectQL plugin init). Delete the key.
migrationsneveroptional[REMOVED] DriverCapabilities.migrations was removed in @objectstack/spec 17.0.0 (ADR-0049 enforce-or-remove) — no code in any repository ever read it, so its value never changed which code path ran. No migration engine ever consulted it. Delete the key.
indexesneveroptional[REMOVED] DriverCapabilities.indexes was removed in @objectstack/spec 17.0.0 (ADR-0049 enforce-or-remove) — no code in any repository ever read it, so its value never changed which code path ran. Declared indexes are materialised by the driver itself during schema sync (SqlDriver.syncDeclaredIndexes); no engine path consulted the bit. Delete the key.
connectionPoolingneveroptional[REMOVED] DriverCapabilities.connectionPooling was removed in @objectstack/spec 17.0.0 (ADR-0049 enforce-or-remove) — no code in any repository ever read it, so its value never changed which code path ran. Pooling is configured via poolConfig and owned by the driver; getPoolStats is duck-typed where monitoring wants it. Nothing consulted the bit. Delete the key.
preparedStatementsneveroptional[REMOVED] DriverCapabilities.preparedStatements was removed in @objectstack/spec 17.0.0 (ADR-0049 enforce-or-remove) — no code in any repository ever read it, so its value never changed which code path ran. Parameterised execution is an implementation detail of the driver (execute(command, parameters)); nothing consulted the bit. Delete the key.
queryCacheneveroptional[REMOVED] DriverCapabilities.queryCache was removed in @objectstack/spec 17.0.0 (ADR-0049 enforce-or-remove) — no code in any repository ever read it, so its value never changed which code path ran. No query-cache layer keyed off it exists; DriverOptions.skipCache is a per-call hint to the driver, not a switch on this bit. Delete the key.

Nested Shape: NoSQLDriverConfig.poolConfig

PropertyTypeRequiredDescription
minnumberoptional (default: 2)Minimum number of connections in pool
maxnumberoptional (default: 10)Maximum number of connections in pool
idleTimeoutMillisnumberoptional (default: 30000)Time in ms before idle connection is closed
connectionTimeoutMillisnumberoptional (default: 5000)Time in ms to wait for available connection

Nested Shape: NoSQLDriverConfig.dataTypeMapping

PropertyTypeRequiredDescription
textstringNoSQL type for text fields
numberstringNoSQL type for number fields
booleanstringNoSQL type for boolean fields
datestringNoSQL type for date fields
datetimestringNoSQL type for datetime fields
jsonstringoptionalNoSQL type for JSON/object fields
uuidstringoptionalNoSQL type for UUID fields
binarystringoptionalNoSQL type for binary fields
arraystringoptionalNoSQL type for array fields
objectIdstringoptionalNoSQL type for ObjectID fields (MongoDB)
geopointstringoptionalNoSQL type for geospatial point fields

Nested Shape: NoSQLDriverConfig.replication

PropertyTypeRequiredDescription
enabledbooleanoptional (default: false)Enable replication
replicaSetNamestringoptionalReplica set name
replicasintegeroptionalNumber of replicas
readPreferenceEnum<'primary' | 'primaryPreferred' | 'secondary' | 'secondaryPreferred' | 'nearest'>optionalRead preference for replica set
writeConcernEnum<'majority' | 'acknowledged' | 'unacknowledged'>optionalWrite concern level

Nested Shape: NoSQLDriverConfig.sharding

PropertyTypeRequiredDescription
enabledbooleanoptional (default: false)Enable sharding
shardKeystringoptionalField to use as shard key
shardingStrategyEnum<'hash' | 'range' | 'zone'>optionalSharding strategy
numShardsintegeroptionalNumber of shards

Nested Shape: NoSQLDriverConfig.schemaValidation

PropertyTypeRequiredDescription
enabledbooleanoptional (default: false)Enable schema validation
validationLevelEnum<'strict' | 'moderate' | 'off'>optionalValidation strictness
validationActionEnum<'error' | 'warn'>optionalAction on validation failure
jsonSchemaRecord<string, any>optionalJSON Schema for validation

NoSQLIndex

Properties

PropertyTypeRequiredDescription
namestringIndex name
typeEnum<'single' | 'compound' | 'unique' | 'text' | 'geospatial' | 'hashed' | 'ttl' | 'sparse'>Index type
fields{ field: string; order?: Enum<'asc' | 'desc' | 'text' | '2dsphere'> }[]Fields to index
uniquebooleanoptional (default: false)Enforce uniqueness over exactly the listed fields. Boolean on purpose — no ADR-0120 scope vocabulary here: this is the raw driver-descriptor layer, below tenancy. The 'organization'/'global' boundary is stated on the authorable surfaces (FieldSchema.unique, IndexSchema.unique) and resolved into physical key columns before a descriptor like this is built, so an organization key part, when there is one, is already a listed field
sparsebooleanoptional (default: false)Sparse index
expireAfterSecondsintegeroptionalTTL in seconds
partialFilterExpressionRecord<string, any>optionalPartial index filter
backgroundbooleanoptional (default: false)Create index in background

Nested Shape: NoSQLIndex.fields[number]

PropertyTypeRequiredDescription
fieldstringField name
orderEnum<'asc' | 'desc' | 'text' | '2dsphere'>optionalIndex order or type

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

PropertyTypeRequiredDescription
consistencyEnum<'all' | 'quorum' | 'one' | 'local_quorum' | 'each_quorum' | 'eventual'>optionalConsistency level override
readFromSecondarybooleanoptionalAllow reading from secondary replicas
projectionRecord<string, 0 | 1>optionalField projection
timeoutintegeroptionalQuery timeout (ms)
useCursorbooleanoptionalUse cursor instead of loading all results
batchSizeintegeroptionalCursor batch size
profilebooleanoptionalEnable query profiling
hintstringoptionalIndex hint for query optimization

NoSQLTransactionOptions

Properties

PropertyTypeRequiredDescription
readConcernEnum<'local' | 'majority' | 'linearizable' | 'snapshot'>optionalRead concern level
writeConcernEnum<'majority' | 'acknowledged' | 'unacknowledged'>optionalWrite concern level
readPreferenceEnum<'primary' | 'primaryPreferred' | 'secondary' | 'secondaryPreferred' | 'nearest'>optionalRead preference
maxCommitTimeMSintegeroptionalTransaction commit timeout (ms)

ReplicationConfig

Properties

PropertyTypeRequiredDescription
enabledbooleanoptional (default: false)Enable replication
replicaSetNamestringoptionalReplica set name
replicasintegeroptionalNumber of replicas
readPreferenceEnum<'primary' | 'primaryPreferred' | 'secondary' | 'secondaryPreferred' | 'nearest'>optionalRead preference for replica set
writeConcernEnum<'majority' | 'acknowledged' | 'unacknowledged'>optionalWrite concern level

ShardingConfig

Properties

PropertyTypeRequiredDescription
enabledbooleanoptional (default: false)Enable sharding
shardKeystringoptionalField to use as shard key
shardingStrategyEnum<'hash' | 'range' | 'zone'>optionalSharding strategy
numShardsintegeroptionalNumber of shards

On this page