FSharp.CosmosDb icon indicating copy to clipboard operation
FSharp.CosmosDb copied to clipboard

Replace doesn't resolve correct id value

Open mickednk opened this issue 3 years ago • 3 comments

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"

mickednk avatar Sep 23 '22 09:09 mickednk

Ha, yeah that's probably true.

I guess I need better test coverage 🤣

aaronpowell avatar Sep 26 '22 23:09 aaronpowell

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?

aaronpowell avatar Oct 17 '22 04:10 aaronpowell

It works for me.

mickednk avatar Oct 19 '22 07:10 mickednk