Advance your Data & AI career with 50 days of live learning, dataviz contests, hands-on challenges, study groups & certifications and more!
Get registeredGet Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now
I'm trying to collect information from a table I have in Power BI in MongoDB.
After creating the table, I created a "MongoDB Insert" column in which I insert the data and after that I invoked a custom column that has the connection to the database, however it is returning an error..
Could someone help me to understand where I'm going wrong?
Thank you for the help!
I have already unchecked the checkbox under Options ->Security -> "Require user approval for new native database queries". I still get the same error with this unchecked.
Solved! Go to Solution.
Hoping to be able to help someone, I leave the solution found.
Code for the MongoDB Insert function:
= Table.AddColumn(#"Changed Type", "MongoDB Insert", each "{
'id':" & Text.From([ID]) & ",
'start_time': '" & Text.From([start_time]) & "',
'feedback': '" & Text.From([feedback]) & "'}")
Code for the invoked function:
(insert_statement as text)=>
let
Insert = Python.Execute("import pymongo; client = pymongo.MongoClient('mongodb://localhost:27017/'); db = client['database-name']; collection = db['collection-name']; data = " & insert_statement & "; result = collection.insert_one(data);")
in
Insert
Thanks!!
Hoping to be able to help someone, I leave the solution found.
Code for the MongoDB Insert function:
= Table.AddColumn(#"Changed Type", "MongoDB Insert", each "{
'id':" & Text.From([ID]) & ",
'start_time': '" & Text.From([start_time]) & "',
'feedback': '" & Text.From([feedback]) & "'}")
Code for the invoked function:
(insert_statement as text)=>
let
Insert = Python.Execute("import pymongo; client = pymongo.MongoClient('mongodb://localhost:27017/'); db = client['database-name']; collection = db['collection-name']; data = " & insert_statement & "; result = collection.insert_one(data);")
in
Insert
Thanks!!
Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!
Check out the October 2025 Power BI update to learn about new features.