I am getting the actions log data using an action constructor in a smart contract. I need to save this data in MongoDB from the smart contract. How can I do this? I didn't get exactly my required solution. How do I use MongoDB in eosio smart contracts? Any help would be appreciated. I am using Ubuntu 18.04 LTS on Windows 10.
You can't access mongodb from smart contract at all. It is executed in closed and segregated context and can't communicate with external network except for internal state. Internal state here means data stored by eosio::multi_index.
Once transaction is recorded, you can make a monitoring daemon to read it from block and do something for your demand like saving data into mongodb.