MongoDB Go Driver 2.0 options.ArrayFilters seems to be gone

Hi,

I was looking into the Go Driver 2.0 migration. It seems to me that “options.ArrayFilters” is gone and the documentation outdated. Picking up on the example and official documentation:

opts := options.FindOneAndUpdate().
SetArrayFilters(options.ArrayFilters{Filters: identifier}).
SetReturnDocument(options.After)

I am unable to find ‘options.ArrayFilters’ in the 2.0 release. The ArrayFilters struct is in the 1.17 release:

but not in the 2.0 release anymore:

Best regards,
Timo

Hi @Timo_Guhring, thanks for catching this! I will pass this on to our Docs team so they can update the documentation

In your example, you can pass the filter in directly now:

opts := options.FindOneAndUpdate().
SetArrayFilters(identifier).
SetReturnDocument(options.After)

Great, thank you! Passing the identifier directly works.

1 Like