Skip to content

Commit 8332e0c

Browse files
committed
Collection/DocumentCollection.dropIndex return type is the same as mongodb driver
1 parent b5469c5 commit 8332e0c

File tree

5 files changed

+16
-15
lines changed

5 files changed

+16
-15
lines changed

.changeset/red-donkeys-turn.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"effect-mongodb": patch
3+
---
4+
5+
`Collection/DocumentCollection.dropIndex` return type is the same as mongodb driver

packages/effect-mongodb/dtslint/Collection.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,10 +169,10 @@ F.pipe(collection, Collection.createIndex({ birthday: 1 }))
169169
// dropIndex
170170
// -------------------------------------------------------------------------------------
171171

172-
// $ExpectType Effect<void, MongoError, never>
172+
// $ExpectType Effect<Document, MongoError, never>
173173
Collection.dropIndex(collection, "birthday_1")
174174

175-
// $ExpectType Effect<void, MongoError, never>
175+
// $ExpectType Effect<Document, MongoError, never>
176176
F.pipe(collection, Collection.dropIndex("birthday_1"))
177177

178178
// -------------------------------------------------------------------------------------

packages/effect-mongodb/dtslint/DocumentCollection.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,10 +178,10 @@ F.pipe(collection, DocumentCollection.createIndex({ birthday: 1 }))
178178
// dropIndex
179179
// -------------------------------------------------------------------------------------
180180

181-
// $ExpectType Effect<void, MongoError, never>
181+
// $ExpectType Effect<Document, MongoError, never>
182182
DocumentCollection.dropIndex(collection, "birthday_1")
183183

184-
// $ExpectType Effect<void, MongoError, never>
184+
// $ExpectType Effect<Document, MongoError, never>
185185
F.pipe(collection, DocumentCollection.dropIndex("birthday_1"))
186186

187187
// -------------------------------------------------------------------------------------

packages/effect-mongodb/src/Collection.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -412,26 +412,24 @@ export const createIndex: {
412412
)
413413
)
414414

415-
// TODO: review return type. Should we return Document like mongodb driver?
416415
export const dropIndex: {
417416
(indexName: string, options?: DropIndexesOptions): <A extends Document, I extends Document, R>(
418417
collection: Collection<A, I, R>
419-
) => Effect.Effect<void, MongoError.MongoError, R>
418+
) => Effect.Effect<Document, MongoError.MongoError, R>
420419
<A extends Document, I extends Document, R>(
421420
collection: Collection<A, I, R>,
422421
indexName: string,
423422
options?: DropIndexesOptions
424-
): Effect.Effect<void, MongoError.MongoError, R>
423+
): Effect.Effect<Document, MongoError.MongoError, R>
425424
} = F.dual(
426425
(args) => isCollection(args[0]),
427426
<A extends Document, I extends Document, R>(
428427
collection: Collection<A, I, R>,
429428
indexName: string,
430429
options?: DropIndexesOptions
431-
): Effect.Effect<void, MongoError.MongoError, R> =>
430+
): Effect.Effect<Document, MongoError.MongoError, R> =>
432431
F.pipe(
433432
Effect.promise(() => collection.collection.dropIndex(indexName, options)),
434-
Effect.asVoid,
435433
Effect.catchAllDefect(mongoErrorOrDie(makeSource(collection, "dropIndex")))
436434
)
437435
)

packages/effect-mongodb/src/DocumentCollection.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -391,28 +391,26 @@ export const createIndex: {
391391
)
392392
)
393393

394-
// TODO: review return type. Should we return Document like mongodb driver?
395394
export const dropIndex: {
396395
(
397396
indexName: string,
398397
options?: DropIndexesOptions
399-
): (collection: DocumentCollection) => Effect.Effect<void, MongoError.MongoError>
398+
): (collection: DocumentCollection) => Effect.Effect<Document, MongoError.MongoError>
400399
(
401400
collection: DocumentCollection,
402401
indexName: string,
403402
options?: DropIndexesOptions
404-
): Effect.Effect<void, MongoError.MongoError>
403+
): Effect.Effect<Document, MongoError.MongoError>
405404
} = F.dual(
406405
(args) => isDocumentCollection(args[0]),
407406
(
408407
collection: DocumentCollection,
409408
indexName: string,
410409
options?: DropIndexesOptions
411-
): Effect.Effect<void, MongoError.MongoError> =>
410+
): Effect.Effect<Document, MongoError.MongoError> =>
412411
F.pipe(
413412
Effect.promise(() => collection.collection.dropIndex(indexName, options)),
414-
Effect.asVoid,
415-
Effect.catchAllDefect(MongoError.mongoErrorDie<void>("dropIndex error"))
413+
Effect.catchAllDefect(MongoError.mongoErrorDie<Document>("dropIndex error"))
416414
)
417415
)
418416

0 commit comments

Comments
 (0)