UNPKG

@datastax/astra-mongoose

Version:

Astra's NodeJS Mongoose compatibility client

40 lines (39 loc) 1.82 kB
import { CollectionFindAndRerankOptions, CollectionIndexingOptions, CollectionSerDesConfig, CollectionVectorOptions, RerankedResult, TableSerDesConfig, HttpOptions, CollectionLexicalOptions } from '@datastax/astra-db-ts'; import * as driver from './driver'; export { driver }; export { default as createAstraUri } from './createAstraUri'; export { default as tableDefinitionFromSchema } from './tableDefinitionFromSchema'; import * as AstraMongooseDriver from './driver'; import type { Mongoose } from 'mongoose'; export { Vectorize, VectorizeOptions } from './driver'; export { AstraMongooseError } from './astraMongooseError'; export type AstraMongoose = Omit<Mongoose, 'connection'> & { connection: AstraMongooseDriver.Connection; }; declare module 'mongodb' { interface CreateCollectionOptions { vector?: CollectionVectorOptions; indexing?: CollectionIndexingOptions<any>; lexical?: CollectionLexicalOptions; } } declare module 'mongoose' { interface ConnectOptions { isTable?: boolean; isAstra?: boolean; sanitizeFilter?: boolean; username?: string; password?: string; httpOptions?: HttpOptions; } interface InsertManyOptions { returnDocumentResponses?: boolean; } interface SchemaOptions { serdes?: CollectionSerDesConfig | TableSerDesConfig; } function setDriver(driver: typeof AstraMongooseDriver): AstraMongoose; interface Model<TRawDocType, TQueryHelpers = {}, TInstanceMethods = {}, TVirtuals = {}, THydratedDocumentType = HydratedDocument<TRawDocType, TVirtuals & TInstanceMethods, TQueryHelpers, TVirtuals>, TSchema = any> { findAndRerank(filter: Record<string, unknown>, options?: CollectionFindAndRerankOptions): Promise<RerankedResult<TRawDocType>[]>; } }