I know there is an answer here to use eval() in some form, and I see in your added comments what you expect the string information would be. But I would if I may strongly discourage you from doing that.
Well actually you are being asked to spawn a mongo shell, which while novel, is probably not going to be very practical.
But before you ever arrive at the inner usage of eval() then I would suggest to please read up on the web and take heed of the warnings.
In the form I have linked to, this is going to fire off arbitrary JavaScript to your server and run the results there. There are big issues with security, and locking and much more related to taking this approach.
Rather yet, how about creating your own API layer that will take the serialized arguments. So instead of storing the whole command in a string, just call an endpoint for say find() and process the arguments.
{
collections: <collection>,
query: <query_condition>,
project: <projection>,
options: <options>
}
Or whatever structure suits you. And there you even have a JSON form in your string that you can use to deserialize into data for your code.
This would to me seem a more logical approach, and safer, then directly sending commands in the form you proposed. And as such is probably more analogous to sending a SQL statement over the wire as text.