I’m not sure what your data looks like, but given Binning is failing because some of your values are objects, I suspect the safest thing to do would be to convert both values to strings with the onError block. So something like this:
$cond: {
if: {$eq: ["status", "failed to login"]},
then: {$convert: {
input: "$lastScraperStatus",
to: "string",
onError: "An error occurred",
onNull: "Input was null or empty"
}},
else: {$convert: {
input: "$status",
to: "string",
onError: "An error occurred",
onNull: "Input was null or empty"
}},
}
}
In your original example you were using $first against lastScraperStatus; you may need to add that back in if it’s important.
LMK if this helps.
Tom