@@ -6,7 +6,7 @@ import { type MongoDataAPIError } from "./errors.js";
6
6
// eslint-disable-next-line @typescript-eslint/ban-types
7
7
type Nullable < T > = T | null ;
8
8
9
- /** A data API response object */
9
+ /** A generic data API response object */
10
10
export type DataAPIResponse < T > = { data ?: T ; error ?: MongoDataAPIError } ;
11
11
12
12
export type FindOneRequestOptions = { projection ?: Document ; sort ?: Document } ;
@@ -16,33 +16,33 @@ export type FindOneResponse<TSchema> = Promise<
16
16
DataAPIResponse < Nullable < WithId < TSchema > > >
17
17
> ;
18
18
19
- /** The MongoDB-specific options for this API method */
19
+ /** The MongoDB-specific options for the find() method */
20
20
export type FindRequestOptions = {
21
21
projection ?: Document ;
22
22
sort ?: Sort ;
23
23
limit ?: number ;
24
24
skip ?: number ;
25
25
} ;
26
26
27
- /** A data API response object */
27
+ /** A data API response object for the find() method */
28
28
export type FindResponse < TSchema > = Promise <
29
29
DataAPIResponse < Array < WithId < TSchema > > >
30
30
> ;
31
31
32
- /** A data API response object */
32
+ /** A data API response object for the insertOne() method */
33
33
export type InsertOneResponse = Promise <
34
34
DataAPIResponse < { insertedId : ObjectId } >
35
35
> ;
36
36
37
- /** A data API response object */
37
+ /** A data API response object for the insertMany() method */
38
38
export type InsertManyResponse = Promise <
39
39
DataAPIResponse < { insertedIds : string [ ] } >
40
40
> ;
41
41
42
- /** The MongoDB-specific options for this API method */
42
+ /** The MongoDB-specific options for the updateOne() method */
43
43
export type UpdateOneRequestOptions = { upsert ?: boolean } ;
44
44
45
- /** A data API response object */
45
+ /** A data API response object for the updateOne() method */
46
46
export type UpdateOneResponse = Promise <
47
47
DataAPIResponse < {
48
48
matchedCount : number ;
@@ -51,10 +51,10 @@ export type UpdateOneResponse = Promise<
51
51
} >
52
52
> ;
53
53
54
- /** The MongoDB-specific options for this API method */
54
+ /** The MongoDB-specific options for the updateMany() method */
55
55
export type UpdateManyRequestOptions = { upsert ?: boolean } ;
56
56
57
- /** A data API response object */
57
+ /** A data API response object for the updateMany() method */
58
58
export type UpdateManyResponse = Promise <
59
59
DataAPIResponse < {
60
60
matchedCount : number ;
@@ -63,10 +63,10 @@ export type UpdateManyResponse = Promise<
63
63
} >
64
64
> ;
65
65
66
- /** The MongoDB-specific options for this API method */
66
+ /** The MongoDB-specific options for the replaceOne() method */
67
67
export type ReplaceOneRequestOptions = { upsert ?: boolean } ;
68
68
69
- /** A data API response object */
69
+ /** A data API response object for the replaceOne() method */
70
70
export type ReplaceOneResponse = Promise <
71
71
DataAPIResponse < {
72
72
matchedCount : number ;
@@ -75,17 +75,17 @@ export type ReplaceOneResponse = Promise<
75
75
} >
76
76
> ;
77
77
78
- /** A data API response object */
78
+ /** A data API response object for the deleteOne() method */
79
79
export type DeleteOneResponse = Promise <
80
80
DataAPIResponse < { deletedCount : number } >
81
81
> ;
82
82
83
- /** A data API response object */
83
+ /** A data API response object for the deleteMany() method */
84
84
export type DeleteManyResponse = Promise <
85
85
DataAPIResponse < { deletedCount : number } >
86
86
> ;
87
87
88
- /** A data API response object */
88
+ /** A data API response object for the aggregate() method */
89
89
export type AggregateResponse < TOutput = Document > = Promise <
90
90
DataAPIResponse < TOutput [ ] >
91
91
> ;
0 commit comments