@@ -202,6 +202,37 @@ export const deleteMany: {
202202 )
203203)
204204
205+ export const updateOne : {
206+ < I extends Document > (
207+ filter : Filter < I > ,
208+ update : UpdateFilter < I > | ReadonlyArray < Document > ,
209+ options ?: UpdateOptions
210+ ) : < A extends Document , I2 extends I , R > (
211+ collection : Collection < A , I2 , R >
212+ ) => Effect . Effect < UpdateResult < I2 > , MongoError . MongoError , R >
213+ < A extends Document , I extends Document , R > (
214+ collection : Collection < A , I , R > ,
215+ filter : Filter < I > ,
216+ update : UpdateFilter < I > | ReadonlyArray < Document > ,
217+ options ?: UpdateOptions
218+ ) : Effect . Effect < UpdateResult < I > , MongoError . MongoError , R >
219+ } = F . dual (
220+ ( args ) => isCollection ( args [ 0 ] ) ,
221+ < A extends Document , I extends Document , R > (
222+ collection : Collection < A , I , R > ,
223+ filter : Filter < I > ,
224+ update : UpdateFilter < I > | ReadonlyArray < Document > ,
225+ options ?: UpdateOptions
226+ ) : Effect . Effect < UpdateResult < I > , MongoError . MongoError , R > =>
227+ Effect . promise ( ( ) =>
228+ collection . collection . updateOne (
229+ filter ,
230+ Array . isArray ( update ) ? [ ...update ] : update as UpdateFilter < Document > ,
231+ options
232+ )
233+ ) . pipe ( Effect . catchAllDefect ( mongoErrorOrDie ( errorSource ( collection , "updateOne" ) ) ) )
234+ )
235+
205236export const updateMany : {
206237 < I extends Document > (
207238 filter : Filter < I > ,
0 commit comments