Skip to content

Commit

Permalink
fix deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
jameson2011 committed Jun 11, 2020
1 parent 0da8f1f commit 5fb4fe5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/zKbProxy/KillProviderActor.fs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ type KillProviderActor(log: PostMessage, stats: PostMessage, config: Configurati
let getKillCount()=
async {
try
return! (dbCollection.CountAsync(fun _ -> true) |> Async.AwaitTask)
return! (dbCollection.CountDocumentsAsync(fun _ -> true) |> Async.AwaitTask)
with
| e -> logException e
return 0L
Expand Down
8 changes: 4 additions & 4 deletions src/zKbProxy/MongoDb.fs
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@
let setIndex (path: string) (collection: IMongoCollection<'a>) =
let json = sprintf "{'%s': 1 }" path
let def = IndexKeysDefinition<'a>.op_Implicit(json)
let model = CreateIndexModel<'a>(def)
let r = collection.Indexes.CreateOne(model)

let r = collection.Indexes.CreateOne(def)

collection

let getCollection colName (db: IMongoDatabase) =
Expand All @@ -113,14 +113,14 @@
initCollection "" server dbName collectionName userName password

let upsert (collection: IMongoCollection<BsonDocument>) (doc: BsonDocument) =
let opts = UpdateOptions()
let opts = ReplaceOptions()
opts.IsUpsert <- true

let filter = doc |> Bson.getId
|> idFilter |> Bson.ofJson
|> FilterDefinition.op_Implicit
collection.ReplaceOne(filter, doc, opts) |> ignore


let delete (collection: IMongoCollection<BsonDocument>) id =

let filter = id |> idFilter |> Bson.ofJson
Expand Down

0 comments on commit 5fb4fe5

Please sign in to comment.