Skip to content

Commit 8fe7647

Browse files
committed
Collection+Db: cleanup and remove some old todos
1 parent 2f4226f commit 8fe7647

File tree

3 files changed

+17
-21
lines changed

3 files changed

+17
-21
lines changed

packages/effect-mongodb/dtslint/Collection.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,10 @@ import * as FindCursor from "effect-mongodb/FindCursor"
44
import * as F from "effect/Function"
55
import * as Schema from "effect/Schema"
66

7-
// TODO: try to use class Schema to improve test assertions
87
const MyType = Schema.Struct({
98
birthday: Schema.Date
109
})
1110
type MyType = typeof MyType.Type
12-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
13-
type MyTypeEncoded = typeof MyType.Encoded
1411

1512
declare const myType: MyType
1613

packages/effect-mongodb/dtslint/Db.ts

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import * as DBX from "effect-mongodb/Db"
1+
import * as Db from "effect-mongodb/Db"
22
import * as F from "effect/Function"
33
import * as Schema from "effect/Schema"
4-
import type { Db } from "mongodb"
4+
import type { Db as MongoDb } from "mongodb"
55

6-
declare const database: Db
6+
declare const database: MongoDb
77

88
const User = Schema.Struct({
99
id: Schema.NumberFromString
@@ -14,56 +14,56 @@ const User = Schema.Struct({
1414
// -------------------------------------------------------------------------------------
1515

1616
// $ExpectType DocumentCollection
17-
DBX.documentCollection(database, "users")
17+
Db.documentCollection(database, "users")
1818

1919
// $ExpectType DocumentCollection
20-
F.pipe(database, DBX.documentCollection("users"))
20+
F.pipe(database, Db.documentCollection("users"))
2121

2222
// -------------------------------------------------------------------------------------
2323
// collection
2424
// -------------------------------------------------------------------------------------
2525

2626
// $ExpectType Collection<{ readonly id: number; }, { readonly id: string; }, never>
27-
DBX.collection(database, "users", User)
27+
Db.collection(database, "users", User)
2828

2929
// $ExpectType Collection<{ readonly id: number; }, { readonly id: string; }, never>
30-
F.pipe(database, DBX.collection("users", User))
30+
F.pipe(database, Db.collection("users", User))
3131

3232
// -------------------------------------------------------------------------------------
3333
// listCollections
3434
// -------------------------------------------------------------------------------------
3535

3636
// $ExpectType ListCollectionsCursor<DefaultCollectionInfo>
37-
DBX.listCollections(database)
37+
Db.listCollections(database)
3838

3939
// TODO: this currently returns `(db: Db) => ListCollectionsCursor<DefaultCollectionInfo>`, why?
4040
// //$ExpectType ListCollectionsCursor<DefaultCollectionInfo>
41-
// F.pipe(database, DBX.listCollections)
41+
// F.pipe(database, Db.listCollections)
4242

4343
// $ExpectType ListCollectionsCursor<DefaultCollectionInfo>
44-
DBX.listCollections(database, { foo: "bar" })
44+
Db.listCollections(database, { foo: "bar" })
4545

4646
// $ExpectType ListCollectionsCursor<DefaultCollectionInfo>
47-
F.pipe(database, DBX.listCollections({ foo: "bar" }))
47+
F.pipe(database, Db.listCollections({ foo: "bar" }))
4848

4949
// $ExpectType NameOnlyListCollectionsCursor
50-
DBX.listCollections(database, { foo: "bar" }, { nameOnly: true })
50+
Db.listCollections(database, { foo: "bar" }, { nameOnly: true })
5151

5252
// $ExpectType NameOnlyListCollectionsCursor
53-
F.pipe(database, DBX.listCollections({ foo: "bar" }, { nameOnly: true }))
53+
F.pipe(database, Db.listCollections({ foo: "bar" }, { nameOnly: true }))
5454

5555
// $ExpectType FullListCollectionsCursor
56-
DBX.listCollections(database, { foo: "bar" }, { nameOnly: false })
56+
Db.listCollections(database, { foo: "bar" }, { nameOnly: false })
5757

5858
// $ExpectType FullListCollectionsCursor
59-
F.pipe(database, DBX.listCollections({ foo: "bar" }, { nameOnly: false }))
59+
F.pipe(database, Db.listCollections({ foo: "bar" }, { nameOnly: false }))
6060

6161
// -------------------------------------------------------------------------------------
6262
// dropCollection
6363
// -------------------------------------------------------------------------------------
6464

6565
// $ExpectType Effect<boolean, MongoError, never>
66-
DBX.dropCollection(database, "users")
66+
Db.dropCollection(database, "users")
6767

6868
// $ExpectType Effect<boolean, MongoError, never>
69-
F.pipe(database, DBX.dropCollection("users"))
69+
F.pipe(database, Db.dropCollection("users"))

packages/effect-mongodb/src/Collection.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,6 @@ export const updateMany: {
216216
export const replaceOne: {
217217
<A extends Document, I extends Document>(
218218
filter: Filter<I>,
219-
// TODO: should we put WithoutId<A> here like the driver signature?
220219
replacement: A,
221220
options?: ReplaceOptions
222221
): <R>(

0 commit comments

Comments
 (0)