Hi!
Instead of Invoke Code try using coded workflows Studio - Coded Workflow (uipath.com)
This thread also mentions something called mongo db crud
Connect Uipath to MongoDB Database? - Help / Studio - UiPath Community Forum
This thread mentions a tutorial you could look into
Uipath and MongoDB connectivity - Learn / Academic Alliance - UiPath Community Forum