Forum Discussion

sharath123's avatar
sharath123
Helper I
4 years ago
Solved

MongoDB Data is not showing in powerbi by using python script

import pymongo from pymongo import MongoClient connection = pymongo.MongoClient("mongodb+srv://<username>:<password>@cluster0.zev7c.mongodb.net/myFirstDatabase?retryWrites=true&w=majority") db=c...
  • loch45's avatar
    loch45
    3 years ago

    This seemed to work:
    # Specify the collection name
    collection = db[
    'your_collection_name']

    # Perform the query
    query = {}  
    # Your query conditions here
    result = collection.find(query)

    # Convert the query result to a DataFrame
    df = pd.DataFrame(result)

    # Print the DataFrame
    print(df)