Skip to content

Commit ba4af45

Browse files
committed
effect-mongodb: format files
1 parent 0e395ac commit ba4af45

File tree

9 files changed

+42
-26
lines changed

9 files changed

+42
-26
lines changed

packages/effect-mongodb/examples/copy-between-dbs.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,10 @@ const program = Effect.gen(function*() {
2424
{ name: "User 3", age: 4, birthday: "2020-11-03T00:00:00Z" }
2525
])
2626

27-
const sourceItems = yield* DocumentCollection.find(sourceCollection).pipe(DocumentFindCursor.typed(MyType), FindCursor.toArray)
27+
const sourceItems = yield* DocumentCollection.find(sourceCollection).pipe(
28+
DocumentFindCursor.typed(MyType),
29+
FindCursor.toArray
30+
)
2831

2932
const destinationInstance = yield* MongoClient.connectScoped("mongodb://localhost:27017")
3033
const destinationDb = MongoClient.db(destinationInstance, "destination")

packages/effect-mongodb/examples/find-with-cursor-builder.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ const program = Effect.gen(function*() {
2222
const myTypes = FastCheck.sample(anyMyType, 100)
2323
yield* Collection.insertMany(sourceCollection, myTypes)
2424

25-
const items = yield* Collection.find(sourceCollection).pipe(FindCursor.sort({ value: -1 }), FindCursor.limit(50), FindCursor.toArray)
25+
const items = yield* Collection.find(sourceCollection).pipe(
26+
FindCursor.sort({ value: -1 }),
27+
FindCursor.limit(50),
28+
FindCursor.toArray
29+
)
2630

2731
yield* Console.log(items)
2832
})

packages/effect-mongodb/examples/find-without-cursor-builder.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ const program = Effect.gen(function*() {
2222
const myTypes = FastCheck.sample(anyMyType, 100)
2323
yield* Collection.insertMany(sourceCollection, myTypes)
2424

25-
const items = yield* Collection.find(sourceCollection, {}, { sort: { value: -1 }, limit: 50 }).pipe(FindCursor.toArray)
25+
const items = yield* Collection.find(sourceCollection, {}, { sort: { value: -1 }, limit: 50 }).pipe(
26+
FindCursor.toArray
27+
)
2628

2729
yield* Console.log(items)
2830
})

packages/effect-mongodb/examples/project.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,14 @@ const program = Effect.gen(function*() {
2727
{ id: 3, values: [1, 5, 33, 96] }
2828
])
2929

30-
const items = yield* Collection.find(sourceCollection).pipe(FindCursor.project(MyTypeProjection, {
31-
id: 1,
32-
valuesCount: { $size: "$values" },
33-
valuesMax: { $max: "$values" }
34-
}), FindCursor.toArray)
30+
const items = yield* Collection.find(sourceCollection).pipe(
31+
FindCursor.project(MyTypeProjection, {
32+
id: 1,
33+
valuesCount: { $size: "$values" },
34+
valuesMax: { $max: "$values" }
35+
}),
36+
FindCursor.toArray
37+
)
3538

3639
yield* Console.log(items)
3740
})

packages/effect-mongodb/src/Collection.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ export const findOne: {
111111
): Effect.Effect<O.Option<A>, MongoError.MongoError | ParseResult.ParseError, R> =>
112112
Effect.gen(function*() {
113113
const value = yield* Effect.promise(() => collection.collection.findOne(filter, options))
114-
return yield* SchemaExt.decodeNullableDocument(collection.schema, value);
114+
return yield* SchemaExt.decodeNullableDocument(collection.schema, value)
115115
}).pipe(
116116
Effect.catchAllDefect(mongoErrorOrDie(errorSource(collection, "findOne")))
117117
)
@@ -331,7 +331,7 @@ export const findOneAndReplace: {
331331
const maybeValue = yield* SchemaExt.decodeNullableDocument(collection.schema, result.value)
332332
return { ...result, value: maybeValue }
333333
}
334-
return yield* SchemaExt.decodeNullableDocument(collection.schema, value);
334+
return yield* SchemaExt.decodeNullableDocument(collection.schema, value)
335335
})
336336
),
337337
Effect.catchAllDefect(

packages/effect-mongodb/test/Collection.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ describeMongo("Collection", (ctx) => {
1717

1818
yield* Collection.insertOne(collection, user)
1919

20-
return yield* Collection.findOne(collection, { name: "john" });
20+
return yield* Collection.findOne(collection, { name: "john" })
2121
})
2222

2323
const result = await Effect.runPromise(program)
@@ -37,7 +37,7 @@ describeMongo("Collection", (ctx) => {
3737
]
3838
yield* Collection.insertMany(collection, users)
3939

40-
return yield* Collection.findOne(collection, { name: "john" });
40+
return yield* Collection.findOne(collection, { name: "john" })
4141
})
4242

4343
const result = await Effect.runPromise(program)
@@ -57,7 +57,7 @@ describeMongo("Collection", (ctx) => {
5757
{ name: "john", version: "v1" },
5858
{ name: "john", version: "v2" },
5959
{ returnDocument: "after" }
60-
);
60+
)
6161
})
6262

6363
const result = await Effect.runPromise(program)
@@ -77,7 +77,7 @@ describeMongo("Collection", (ctx) => {
7777
{ name: "john", version: "v1" },
7878
{ name: "john", version: "v2" },
7979
{ returnDocument: "after", includeResultMetadata: true }
80-
);
80+
)
8181
})
8282

8383
const result = await Effect.runPromise(program)
@@ -118,7 +118,7 @@ describeMongo("Collection", (ctx) => {
118118
{
119119
$sort: { _id: 1 }
120120
}
121-
]).pipe(AggregationCursor.toArray);
121+
]).pipe(AggregationCursor.toArray)
122122
})
123123

124124
const result = await Effect.runPromise(program)

packages/effect-mongodb/test/DocumentCollection.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ describeMongo("DocumentCollection", (ctx) => {
4545

4646
yield* DocumentCollection.insertOne(collection, new MyClass("John"))
4747

48-
return yield* DocumentCollection.find(collection).pipe(DocumentFindCursor.toArray);
48+
return yield* DocumentCollection.find(collection).pipe(DocumentFindCursor.toArray)
4949
})
5050

5151
const result = await Effect.runPromise(program)
@@ -65,7 +65,7 @@ describeMongo("DocumentCollection", (ctx) => {
6565
[{ name: "ANY_NAME_1" }, { name: "john" }, { name: "ANY_NAME_2" }]
6666
)
6767

68-
return yield* DocumentCollection.findOne(collection, { name: "john" });
68+
return yield* DocumentCollection.findOne(collection, { name: "john" })
6969
})
7070

7171
const result = await Effect.runPromise(program)
@@ -83,7 +83,7 @@ describeMongo("DocumentCollection", (ctx) => {
8383
[{ name: "ANY_NAME_1" }, { name: "ANY_NAME_2" }, { name: "ANY_NAME_3" }]
8484
)
8585

86-
return yield* DocumentCollection.findOne(collection, { name: "john" });
86+
return yield* DocumentCollection.findOne(collection, { name: "john" })
8787
})
8888

8989
const result = await Effect.runPromise(program)
@@ -103,7 +103,7 @@ describeMongo("DocumentCollection", (ctx) => {
103103
{ name: "john", version: "v1" },
104104
{ name: "john", version: "v2" },
105105
{ returnDocument: "after" }
106-
);
106+
)
107107
})
108108

109109
const result = await Effect.runPromise(program)
@@ -123,7 +123,7 @@ describeMongo("DocumentCollection", (ctx) => {
123123
{ name: "john", version: "v1" },
124124
{ name: "john", version: "v2" },
125125
{ returnDocument: "after", includeResultMetadata: true }
126-
);
126+
)
127127
})
128128

129129
const result = await Effect.runPromise(program)

packages/effect-mongodb/test/DocumentFindCursor.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ describeMongo("DocumentFindCursor", (ctx) => {
2929
DocumentFindCursor.project({ _id: 0, id: 1 }),
3030
DocumentFindCursor.limit(2),
3131
DocumentFindCursor.toArray
32-
);
32+
)
3333
})
3434

3535
const result = await Effect.runPromise(program)
@@ -54,7 +54,7 @@ describeMongo("DocumentFindCursor", (ctx) => {
5454
DocumentFindCursor.toStream,
5555
Stream.runCollect,
5656
Effect.map(Chunk.toReadonlyArray)
57-
);
57+
)
5858
})
5959

6060
const result = await Effect.runPromise(program)

packages/effect-mongodb/test/FindCursor.test.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ describeMongo("FindCursor", (ctx) => {
4343
FindCursor.project(UserProjection, { _id: 0, id: 1 }),
4444
FindCursor.limit(2),
4545
FindCursor.toArray
46-
);
46+
)
4747
})
4848

4949
const result = await Effect.runPromise(program)
@@ -61,7 +61,7 @@ describeMongo("FindCursor", (ctx) => {
6161
yield* DocumentCollection.insertOne(documentCollection, { id: 999, surname: "foo" })
6262
yield* Collection.insertMany(collection, FastCheck.sample(UserArbitrary, 3))
6363

64-
return yield* Collection.find(collection).pipe(FindCursor.toArrayEither);
64+
return yield* Collection.find(collection).pipe(FindCursor.toArrayEither)
6565
})
6666

6767
const result = await Effect.runPromise(program)
@@ -83,7 +83,11 @@ describeMongo("FindCursor", (ctx) => {
8383

8484
yield* Collection.insertMany(collection, anyUsers)
8585

86-
return yield* Collection.find(collection).pipe(FindCursor.toStream, Stream.runCollect, Effect.map(Chunk.toReadonlyArray));
86+
return yield* Collection.find(collection).pipe(
87+
FindCursor.toStream,
88+
Stream.runCollect,
89+
Effect.map(Chunk.toReadonlyArray)
90+
)
8791
})
8892

8993
const result = await Effect.runPromise(program)
@@ -105,7 +109,7 @@ describeMongo("FindCursor", (ctx) => {
105109
FindCursor.toStreamEither,
106110
Stream.runCollect,
107111
Effect.map(Chunk.toReadonlyArray)
108-
);
112+
)
109113
})
110114

111115
const result = await Effect.runPromise(program)

0 commit comments

Comments
 (0)