View source: R/mongo_connector.R
mongo_tables_create | R Documentation |
MongoDB database don't enforce a structure to the documents contained within. Even though this is true, it's best to use this function explicitly, as after creation of collections it also create appropriate indexes for quick querying of the database by RegLogMongoConnector.
mongo_tables_create( mongo_url, mongo_db, mongo_options = mongolite::ssl_options(), account_name = "account", reset_code_name = "reset_code", user_data = NULL, hash_passwords = FALSE, verbose = TRUE )
mongo_url |
URI to the MongoDB cluster |
mongo_db |
name of the MongoDB database |
mongo_options |
additional connection options such as SSL keys/certs |
account_name |
Name of the collection for storing user accounts credentials. Defaults to 'account'. Mandatory collection. |
reset_code_name |
Name of the collector for storing generated password reset codes. Defaults to 'reset_code'. Mandatory collection. |
user_data |
If you wish to import existing user database, you can input data.frame with that table in this argument. It should contain columns: username, password, email (ond optionally: create_time). Defaults to NULL. |
hash_passwords |
If you are importing table of users upon tables creation,
you can also specify if the password should be hashed using |
verbose |
Boolean specific if the actions made by function should be printed back to the console. |
Every document in created collections will have following structure:
account (default name)
username: character (index)
password: character
email: character (index)
create_time: timestamp
update_time: timestamp
reset_code (default name)
user_id: character (index)
reset_code: character
used: numeric
create_time: timestamp
update_time: timestamp
logs (default name, optional) - this collection isn't created with this function, as there is no need for that - MongoDB collections don't have a set structure, and no additional index is created there.
time: timestamp
session: character
direction: character
type: character
note: character
Other RegLog databases:
DBI_tables_create()
,
gsheet_tables_create()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.