You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm having trouble returning the created documents from UpdateDocumentsWithOptions(). I also noticed there are no tests for this method, only for the single document update.
This works fine (updating a single document), the updated document is returned from the function:
Manual checks confirm that the documents are properly updated in the database. I tried calling Read()on the response object but got an error message: json: cannot unmarshal object into Go struct field .new of type []*<myType>
The text was updated successfully, but these errors were encountered:
Thanks for pointing out the test for me. I realized that I should not be passing a slice as NewObject on the options struct. If I instead pass an instance of T, I do get the updated document by reading that variable for each iteration on meta.Read().
However this approach does not easily let me append these documents to a slice and return them from the function, as the slice will end up with pointers to the last document read. Also, doing type assertion on meta.New and appending those objects yields the same result.
I'm having trouble returning the created documents from
UpdateDocumentsWithOptions()
. I also noticed there are no tests for this method, only for the single document update.This works fine (updating a single document), the updated document is returned from the function:
This however returns an empty slice:
Manual checks confirm that the documents are properly updated in the database. I tried calling
Read()
on the response object but got an error message:json: cannot unmarshal object into Go struct field .new of type []*<myType>
The text was updated successfully, but these errors were encountered: