get_mongo_collection | R Documentation |
Retrieve all data from a mongodb collection. Optionally, replace the collection data first.
get_mongo_collection(collection, db, connection_string, replace_with = NULL)
collection |
Name of the collection. |
db |
Name of the database the collection is in. |
connection_string |
Address of the mongodb server in mongo connection string [URI format](https://docs.mongodb.com/manual/reference/connection-string/). |
replace_with |
Default is NULL. If passed, must be a dataframe, named list (for single record) or character vector with json strings (one string for each row). |
Returns all data in the given collection as a dataframe.
## Not run: # Get the data in my_collection (in the my_db database) get_mongo_collection( "my_collection", "my_db", connection_string = glue::glue( "mongodb+srv://{MONGO_USER}:{MONGO_PASS}@{MONGO_HOST}", "/?tls=true&retryWrites=true&w=majority" ) ) # Replace the data in my_collection (in the my_db database) with the data in # my_dataframe, then get that data get_mongo_collection( "my_collection", "my_db", connection_string = glue::glue( "mongodb+srv://{MONGO_USER}:{MONGO_PASS}@{MONGO_HOST}", "/?tls=true&retryWrites=true&w=majority" ), replace_with = my_dataframe ) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.