Get data
Tags: #mongodb #database #naas_drivers #snippet
Author: Florent Ravenel

Input

Import library

1
from naas_drivers import mongo
Copied!

Setup your MongoDB

1
# Credentials
2
user = "my user"
3
passwd = "my passwd"
4
host = "url"
5
port = 9090
6
7
# DB parameters
8
collection_name = "col"
9
db_name = "db_name"
Copied!

Model

Get data

1
df = naas_drivers.mongo.connect(host, port, user, passwd).get(collection_name, db_name)
Copied!

Output

Display result

1
df
Copied!
Last modified 2mo ago
Copy link
Edit on GitHub