0

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.

1

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.

| improve this answer | |
  • Hi..thanx for the answer. Monitoring daemon to read means accessing smart contract related data through API like eos-sharp or eosjs. right? – Varsh Apr 22 at 2:14
  • @Varsh Correct. – conr2d Apr 22 at 3:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.