Version: next

MongoDBDataProvider

Graphback provider that connnects to the MongoDB database

Type parameters

Type

Hierarchy

  • MongoDBDataProvider

Implements

  • GraphbackDataProvider‹Type›

Index

Constructors

Properties

Methods

Constructors

constructor

+ new MongoDBDataProvider(baseType: GraphQLObjectType, db: any): MongoDBDataProvider

Defined in MongoDBDataProvider.ts:20

Parameters:

NameType
baseTypeGraphQLObjectType
dbany

Returns: MongoDBDataProvider

Properties

Protected coerceTSFields

coerceTSFields: boolean

Defined in MongoDBDataProvider.ts:20


Protected collectionName

collectionName: string

Defined in MongoDBDataProvider.ts:17


Protected db

db: Db

Defined in MongoDBDataProvider.ts:16


Protected fieldTransformMap

fieldTransformMap: FieldTransformMap

Defined in MongoDBDataProvider.ts:19


Protected tableMap

tableMap: ModelTableMap

Defined in MongoDBDataProvider.ts:18

Methods

batchRead

batchRead(relationField: string, ids: string[], filter: any, context: GraphbackContext): Promise‹Type[][]›

Defined in MongoDBDataProvider.ts:130

Parameters:

NameType
relationFieldstring
idsstring[]
filterany
contextGraphbackContext

Returns: Promise‹Type[][]›


Protected buildProjectionOption

buildProjectionOption(context: GraphbackContext): object

Defined in MongoDBDataProvider.ts:181

Parameters:

NameType
contextGraphbackContext

Returns: object

  • [field]: number = 1

count

count(filter: any): Promise‹number›

Defined in MongoDBDataProvider.ts:126

Parameters:

NameType
filterany

Returns: Promise‹number›


create

create(data: any, context: GraphbackContext): Promise‹Type›

Defined in MongoDBDataProvider.ts:33

Parameters:

NameType
dataany
contextGraphbackContext

Returns: Promise‹Type›


delete

delete(data: Type, context: GraphbackContext): Promise‹Type›

Defined in MongoDBDataProvider.ts:79

Parameters:

NameType
dataType
contextGraphbackContext

Returns: Promise‹Type›


findBy

findBy(filter: QueryFilter‹Type›, context: GraphbackContext, page?: GraphbackPage, orderBy?: GraphbackOrderBy): Promise‹Type[]›

Defined in MongoDBDataProvider.ts:113

Parameters:

NameType
filterQueryFilter‹Type›
contextGraphbackContext
page?GraphbackPage
orderBy?GraphbackOrderBy

Returns: Promise‹Type[]›


findOne

findOne(filter: any, context: GraphbackContext): Promise‹Type›

Defined in MongoDBDataProvider.ts:99

Parameters:

NameType
filterany
contextGraphbackContext

Returns: Promise‹Type›


Protected mapFields

mapFields(document: any): any

Defined in MongoDBDataProvider.ts:173

Parameters:

NameType
documentany

Returns: any


Private sortQuery

sortQuery(query: Cursor‹any›, orderBy: GraphbackOrderBy): Cursor‹any›

Defined in MongoDBDataProvider.ts:195

Parameters:

NameType
queryCursor‹any›
orderByGraphbackOrderBy

Returns: Cursor‹any›


update

update(data: Type, context: GraphbackContext): Promise‹Type›

Defined in MongoDBDataProvider.ts:54

Parameters:

NameType
dataType
contextGraphbackContext

Returns: Promise‹Type›


Private usePage

usePage(query: Cursor‹any›, page?: GraphbackPage): Promise‹any[]›

Defined in MongoDBDataProvider.ts:213

Parameters:

NameType
queryCursor‹any›
page?GraphbackPage

Returns: Promise‹any[]›