@datastax/astra-mongoose
Version:
Astra's NodeJS Mongoose compatibility client
9 lines (8 loc) • 405 B
TypeScript
import { CreateTableDefinition, StrictCreateTableColumnDefinition } from '@datastax/astra-db-ts';
import { Schema } from 'mongoose';
/**
* Given a Mongoose schema, create an equivalent Data API table definition for use with `createTable()`
*/
export default function tableDefinitionFromSchema(schema: Schema): CreateTableDefinition & {
columns: Record<string, StrictCreateTableColumnDefinition>;
};