You will need to use Chef Search for this. I don't know what your exact query will be, but here's an example:
mongos = search(:node, 'role:mongo')
mongo_addresses = mongos.map { |mongo| "#{mongo['fqdn']}:#{mongo['mongo']['port']}" }
bash "start mongos" do
code "mongos --configdb #{mongo_addresses.join(',')} --fork --logpath /var/log/mongodb.log"
end
Note: this is for demonstration purposes. Without more information about the structure of your mongo cookbook and Chef Server setup, I can't give you "copy-paste" code.