Collection | mongodb (original) (raw)
aggregate
- aggregate<T>(pipeline?, options?): AggregationCursor<T>
Type Parameters
Returns AggregationCursor<T>
bulkWrite
- bulkWrite(operations, options?): Promise<BulkWriteResult>
BulkWriteResult>
Returns Promise<
count
- count(filter?, options?): Promise<number>
Returns Promise<number>
countDocuments
- countDocuments(filter?, options?): Promise<number>
Returns Promise<number>
createIndex
- createIndex(indexSpec, options?): Promise<string>
Returns Promise<string>
createIndexes
- createIndexes(indexSpecs, options?): Promise<string[]>
Returns Promise<string[]>
createSearchIndex
- createSearchIndex(description): Promise<string>
Returns Promise<string>
A promise that resolves to the name of the new search index.
createSearchIndexes
- createSearchIndexes(descriptions): Promise<string[]>
Returns Promise<string[]>
A promise that resolves to an array of the newly created search index names.
deleteMany
- deleteMany(filter?, options?): Promise<DeleteResult>
DeleteResult>
Returns Promise<
deleteOne
- deleteOne(filter?, options?): Promise<DeleteResult>
DeleteResult>
Returns Promise<
distinct
- distinct<Key>(key): Promise<Flatten<WithId<TSchema>[Key]>[]>
Type Parameters
- Key extends string | number | symbol
Returns Promise<Flatten<WithId<TSchema>[Key]>[]>
- distinct<Key>(key, filter): Promise<Flatten<WithId<TSchema>[Key]>[]>
Type Parameters
- Key extends string | number | symbol
Returns Promise<Flatten<WithId<TSchema>[Key]>[]>
- distinct<Key>(key, filter, options): Promise<Flatten<WithId<TSchema>[Key]>[]>
Type Parameters
- Key extends string | number | symbol
Returns Promise<Flatten<WithId<TSchema>[Key]>[]>
- distinct(key): Promise<any[]>
Returns Promise<any[]>
- distinct(key, filter): Promise<any[]>
Returns Promise<any[]>
- distinct(key, filter, options): Promise<any[]>
Returns Promise<any[]>
drop
- drop(options?): Promise<boolean>
Returns Promise<boolean>
dropIndex
dropIndexes
- dropIndexes(options?): Promise<boolean>
Returns Promise<boolean>
dropSearchIndex
- dropSearchIndex(name): Promise<void>
Returns Promise<void>
estimatedDocumentCount
- estimatedDocumentCount(options?): Promise<number>
Returns Promise<number>
find
- find(): FindCursor<WithId<TSchema>>
FindCursor<WithId<TSchema>>
Returns- find(filter, options?): FindCursor<WithId<TSchema>>
FindCursor<WithId<TSchema>>
Returns- find<T>(filter, options?): FindCursor<T>
Type Parameters
- T extends Document
Returns FindCursor<T>
findOne
- findOne(): Promise<null | WithId<TSchema>>
WithId<TSchema>>
Returns Promise<null |- findOne(filter): Promise<null | WithId<TSchema>>
WithId<TSchema>>
Returns Promise<null |- findOne(filter, options): Promise<null | WithId<TSchema>>
WithId<TSchema>>
Returns Promise<null |- findOne<T>(): Promise<null | T>
Type Parameters
- T = TSchema
Returns Promise<null | T>
Returns Promise<null | T>
Parameters
- filter: Filter<TSchema>
Optional
options: Omit<FindOptions<Document>, "timeoutMode"> & Abortable
Returns Promise<null | T>
findOneAndDelete
- findOneAndDelete(filter, options): Promise<ModifyResult<TSchema>>
ModifyResult<TSchema>>
Returns Promise<- findOneAndDelete(filter, options): Promise<null | WithId<TSchema>>
Parameters
- filter: Filter<TSchema>
- options: FindOneAndDeleteOptions & {
includeResultMetadata: false;
}
Returns Promise<null | WithId<TSchema>>
- findOneAndDelete(filter, options): Promise<null | WithId<TSchema>>
WithId<TSchema>>
Returns Promise<null |- findOneAndDelete(filter): Promise<null | WithId<TSchema>>
WithId<TSchema>>
Returns Promise<null |
findOneAndReplace
- findOneAndReplace(filter, replacement, options): Promise<ModifyResult<TSchema>>
Parameters
- filter: Filter<TSchema>
- replacement: WithoutId<TSchema>
- options: FindOneAndReplaceOptions & {
includeResultMetadata: true;
}
Returns Promise<ModifyResult<TSchema>>
- findOneAndReplace(filter, replacement, options): Promise<null | WithId<TSchema>>
Parameters
- filter: Filter<TSchema>
- replacement: WithoutId<TSchema>
- options: FindOneAndReplaceOptions & {
includeResultMetadata: false;
}
Returns Promise<null | WithId<TSchema>>
- findOneAndReplace(filter, replacement, options): Promise<null | WithId<TSchema>>
WithId<TSchema>>
Returns Promise<null |- findOneAndReplace(filter, replacement): Promise<null | WithId<TSchema>>
WithId<TSchema>>
Returns Promise<null |
findOneAndUpdate
- findOneAndUpdate(filter, update, options): Promise<ModifyResult<TSchema>>
Parameters
- filter: Filter<TSchema>
- update: Document[] | UpdateFilter<TSchema>
- options: FindOneAndUpdateOptions & {
includeResultMetadata: true;
}
Returns Promise<ModifyResult<TSchema>>
- findOneAndUpdate(filter, update, options): Promise<null | WithId<TSchema>>
Parameters
- filter: Filter<TSchema>
- update: Document[] | UpdateFilter<TSchema>
- options: FindOneAndUpdateOptions & {
includeResultMetadata: false;
}
Returns Promise<null | WithId<TSchema>>
- findOneAndUpdate(filter, update, options): Promise<null | WithId<TSchema>>
Parameters
- filter: Filter<TSchema>
- update: Document[] | UpdateFilter<TSchema>
- options: FindOneAndUpdateOptions
Returns Promise<null | WithId<TSchema>>
- findOneAndUpdate(filter, update): Promise<null | WithId<TSchema>>
WithId<TSchema>>
Returns Promise<null |
indexes
- indexes(options): Promise<IndexDescriptionInfo[]>
IndexDescriptionInfo[]>
Returns Promise<- indexes(options): Promise<IndexDescriptionCompact>
IndexDescriptionCompact>
Returns Promise<- indexes(options): Promise<IndexDescriptionCompact | IndexDescriptionInfo[]>
IndexDescriptionCompact | IndexDescriptionInfo[]>
Returns Promise<- indexes(options?): Promise<IndexDescriptionInfo[]>
IndexDescriptionInfo[]>
Returns Promise<
indexExists
- indexExists(indexes, options?): Promise<boolean>
Returns Promise<boolean>
indexInformation
- indexInformation(options): Promise<IndexDescriptionInfo[]>
IndexDescriptionInfo[]>
Returns Promise<- indexInformation(options): Promise<IndexDescriptionCompact>
IndexDescriptionCompact>
Returns Promise<- indexInformation(options): Promise<IndexDescriptionCompact | IndexDescriptionInfo[]>
IndexDescriptionCompact | IndexDescriptionInfo[]>
Returns Promise<- indexInformation(): Promise<IndexDescriptionCompact>
IndexDescriptionCompact>
Returns Promise<
initializeOrderedBulkOp
- initializeOrderedBulkOp(options?): OrderedBulkOperation
OrderedBulkOperation
Returns
initializeUnorderedBulkOp
- initializeUnorderedBulkOp(options?): UnorderedBulkOperation
UnorderedBulkOperation
Returns
insertMany
- insertMany(docs, options?): Promise<InsertManyResult<TSchema>>
InsertManyResult<TSchema>>
Returns Promise<
insertOne
- insertOne(doc, options?): Promise<InsertOneResult<TSchema>>
InsertOneResult<TSchema>>
Returns Promise<
isCapped
- isCapped(options?): Promise<boolean>
Returns Promise<boolean>
listIndexes
- listIndexes(options?): ListIndexesCursor
ListIndexesCursor
Returns
listSearchIndexes
- listSearchIndexes(options?): ListSearchIndexesCursor
ListSearchIndexesCursor
Returns- listSearchIndexes(name, options?): ListSearchIndexesCursor
ListSearchIndexesCursor
Returns
options
rename
- rename(newName, options?): Promise<Collection<Document>>
Collection<Document>>
Returns Promise<
replaceOne
- replaceOne(filter, replacement, options?): Promise<UpdateResult<TSchema>>
UpdateResult<TSchema>>
Returns Promise<
updateMany
- updateMany(filter, update, options?): Promise<UpdateResult<TSchema>>
Parameters
- filter: Filter<TSchema>
- update: Document[] | UpdateFilter<TSchema>
Optional
options: UpdateOptions
Returns Promise<UpdateResult<TSchema>>
updateOne
- updateOne(filter, update, options?): Promise<UpdateResult<TSchema>>
Parameters
- filter: Filter<TSchema>
- update: Document[] | UpdateFilter<TSchema>
Optional
options: UpdateOptions
Returns Promise<UpdateResult<TSchema>>
updateSearchIndex
- updateSearchIndex(name, definition): Promise<void>
Parameters
- name: string
- definition: Document
Returns Promise<void>
watch
- watch<TLocal, TChange>(pipeline?, options?): ChangeStream<TLocal, TChange>
Type Parameters
- TLocal extends Document = TSchema
- TChange extends Document = ChangeStreamDocument<TLocal>