bridge-mongo
Advanced tools
Comparing version 1.0.7 to 1.0.8
import { Pretify, StricProperty, Plurial } from '../utils'; | ||
import { ObjectId, ClientSession, UpdateQuery } from 'mongoose'; | ||
import { Schema as SchemaClass } from '../schema'; | ||
import { InferSchemaDefFromSchema, Schema as SchemaClass, SchemaToType } from '../schema'; | ||
import { CreateReturnWithErrors, Projection, CompleteProj, convertDBSchemasToDBI, FindOptions, ApplyProj, FindOneOptions, FindAndUpdateOptions, FindAndDeleteOptions, MatchQuery, IncludeIdAndTimestampsAndDefaultProperties } from './types'; | ||
export interface BridgeModelI<SchemasI extends Record<string, any>, ModelName extends keyof SchemasI & string, DBI = Pretify<convertDBSchemasToDBI<SchemasI>>, Schema extends SchemaClass<any, any> = SchemasI[ModelName], ModelI = DBI[Plurial<Lowercase<ModelName>> & keyof DBI]> { | ||
create: <CreateData extends Omit<ModelI, '_id' | 'updatedAt' | 'createdAt'>>(data: StricProperty<CreateData, ModelI>, options?: { | ||
create: <CreateData extends SchemaToType<InferSchemaDefFromSchema<Schema>>>(data: StricProperty<CreateData, ModelI>, options?: { | ||
session?: ClientSession; | ||
@@ -8,0 +8,0 @@ }) => Promise<Pretify<CreateReturnWithErrors<Schema, IncludeIdAndTimestampsAndDefaultProperties<ModelI, Schema, CreateData>, ModelName>>>; |
@@ -30,3 +30,3 @@ "use strict"; | ||
async () => { | ||
const user = await DB.user.modelInterface; | ||
const user = await DB.user.create({ name: 'ui', age: 89 }); | ||
if ((0, source_1.isError)(user)) | ||
@@ -33,0 +33,0 @@ return; |
{ | ||
"name": "bridge-mongo", | ||
"version": "1.0.7", | ||
"version": "1.0.8", | ||
"description": "A mongodb ORM on top of mongoose that match perfectly with the Bridge framework", | ||
@@ -5,0 +5,0 @@ "main": "dist/source/index.js", |
Sorry, the diff of this file is not supported yet
58997