Is there any way to use string or json object as aggregation pipeline

I have string like this:
[{$match: {owner_id: “271726440641331200”}}, {$sort: {likes: 1}},]
So is that possible to use it as pipeline somehow?

Hi @Celebrity_N_A ,

Perhaps you could parse it into json (without the extra comma) and cast it as a pipeline input?

Thanks
Pavel

I cant parse it to json due to this:
SyntaxError: Unexpected token $

Pure JSON requires keys to be in quotes.

1 Like

Thank u all so much

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.