Skip to content
This repository was archived by the owner on Oct 1, 2024. It is now read-only.

ZikaCodez/mongodb-setup

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 

Repository files navigation

Warning

This repository has been archived as it's outdated

How to setup MongoDB

Start by creating an organization

  • Create a new organization

  • Give it a cool name

  • Choose MongoDB Atlas

  • Then, hit Next and Create Organization!

Now you've made a MongoDB organization, what's next?

Create a project

  • Click on New Project

  • Name it, then hit Next!

  • Click Create Project

Setup your database

  • Now, build a new database!

  • Pick the free option on the right
  • Choose these options:

  • Create your new cluster!

  • After creating your cluster, you'll find yourself on this page. Enter a username and a secure password that will be used for authorization in the bot's code, then hit create user.

  • Your cluster will take a few moments to create, wait until these buttons turn white.

  • After they turned white, click on connect, and perform these steps:

Names can be changed to your liking.

After successfully setting up MongoDB, go ahead and use it in your code!

import pymongo
from pymongo import MongoClient

client = MongoClient("the connection string you copied (MAKE SURE YOU CHANGE <PASSWORD> WITH YOUR USER'S PASSWORD!)")

db = client["MainDB"]
threads = db["threads"]
closed_threads = db["closed_threads"]

About

A tutorial on how to setup MongoDB's database for Python

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published