Its not clear from the documenation of the mongodb3 node that you can dynamically pass a URI for the db. maybe its not supported.
The node hasnt been updated for more than 3 years and very recently another user was getting errors with the aggregation option of the same node (forum post)
I did some tests with the more recent and updated node-red-node-mongodb
I think you should use this instead