ReplaceOne operator is not supported for mongo db

Replace character in string during projecting the data.
I am getting this error for replaceOne operator, which works perfectly directly on mongo, but it's making an issue when I try to use it through metabase

$replaceOne' on server The full response is { "ok" : 0.0, "errmsg" : "unknown operator: $replaceOne", "code" : 168, "codeName" : "168"

This error shows when I try to use replaceOne operator on projection section

"hashtag": { $replaceOne: { input: "$hashtag", find: "#", replacement: "%23" } },

Can u please advice

Hi @alaahammouda
Which version of Mongo are you using? Seems like there has been a lot of changes to that operator, but it's working as expected, when I test with Mongo 5.0

1 Like

I use ltrim here and it fix my issue without the hassle of upgrading mongo

1 Like