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

Issue deleting an item from a container #58

Closed mabasic closed 3 years ago

mabasic commented 3 years ago

Is the code in this repository for deleting items correct?

Taken from samples directory:

let deletePowell = deleteFamily conn "Powell.1" "Powell"

do!
    deletePowell
    |> AsyncSeq.iter (fun f -> printfn "Deleted: %A" f)

It seems to do nothing. iter does not seem to be called.

mabasic commented 3 years ago

When debugging the code I get this exception:

Exception has occurred: CLR/System.AggregateException
An exception of type 'System.AggregateException' occurred in System.Private.CoreLib.dll but was not handled in user code: 'One or more errors occurred.'
 Inner exceptions found, see $exception in variables window for more details.
 Innermost exception     Azure.Cosmos.CosmosException : Response status code does not indicate success: 404 Substatus: 0 Reason: ({}).
   at Microsoft.Azure.Cosmos.ResponseMessage.EnsureSuccessStatusCode()
   at Azure.Cosmos.CoreExtensions.EnsureSuccessStatusCode(Response response)
   at Azure.Cosmos.CosmosResponseFactory.ToObjectInternal[T](Response response, CosmosSerializer jsonSerializer)
   at Azure.Cosmos.CosmosResponseFactory.<CreateItemResponseAsync>b__9_0[T](Response cosmosResponseMessage)
   at Azure.Cosmos.CosmosResponseFactory.<ProcessMessageAsync>d__17`1.MoveNext()
mabasic commented 3 years ago

My bad. It seems that I was providing it the wrong partition key value. I thought that it needed the partition key (id) and not the partition key value.

Related https://github.com/Azure/azure-cosmos-dotnet-v3/issues/2742