aaronpowell / FSharp.CosmosDb

An F# wrapper around Cosmos DB's .NET SDK to make it more friendly for F# developers
MIT License
79 stars 12 forks source link

Replace doesn't resolve correct id value #69

Closed mickednk closed 1 year ago

mickednk commented 2 years ago

When doing a replace of an item the value "id" is resolved instead of the value of the property "id" if you haven't added an IdAttribute on the id property.

I think this is where the issue lies.

let getIdFieldName<'T> (item: 'T) =
    let idAttr = IdAttributeTools.findId<'T> ()

    match idAttr with
    | Some attr -> attr.GetValue(item).ToString()
    | None -> "id"
aaronpowell commented 2 years ago

Ha, yeah that's probably true.

I guess I need better test coverage 🤣

aaronpowell commented 2 years ago

Got around to patching this, you'll find a build available here: https://github.com/aaronpowell/FSharp.CosmosDb/packages/530463?version=1.2.1-ci-3261757948

Can you verify @mickednk before I merge it?

mickednk commented 2 years ago

It works for me.