$convert int to binData fails

I am attempting to convert an integer field to hex by using $convert passing from int to binData and then from binData to string with format hex:

image

The first step - converting int to binData yields onError result.

I am using mongo 8.0.4

There is some discrepancy between the release notes for mongo 8 which suggest that only string to binData and vice versa are possible but in the documentation for $convert it shows int and string conversion prototypes. Additionally, the int to binData conversion doesn’t accept the argument ‘byteOrder’.

All of this leads me to suspect that this is featuring for 8.0.5 or perhaps 8.1 which I don’t currently have access to via the routes in which I pull my versioning. Wanted to see if I could get some clarification or perhaps some suggestions for alternate approaches.

Thanks

bump for any thoughts

Hi,

In order for us to be able to help:

  1. Could you paste your aggregation pipeline (or just that one stage) as text so that we can actually edit/debug it. Typing out code from an image is not ideal.
  2. Provide some example data (as text), and optionally, in Mongo Playground (even if it doesn’t work in v6)

That stage in the image appears to have three converts:

  1. The innermost $convert → input → $convert → input has { $toInt: ... } (which is a shorthand for $convert: { to: "int" })
  2. Then there’s the second-level $convert → input → $convert
  3. The outermost $convert.