Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Seed data #195

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft

Seed data #195

wants to merge 5 commits into from

Conversation

dhruvsangamwar
Copy link
Member

@dhruvsangamwar dhruvsangamwar commented Aug 15, 2021

Relevant issue

Closes #140

Summary of change

Added seeder.py which inserts 100 documents with randomized user data into Staging/users collection.
Added cleanDB.py which clears the collection of previously seeded documents.

Testing/Verification

Tested it by running the script and then checking the collection.

dhruvsangamwar and others added 5 commits July 20, 2021 21:54
Initial script used MongoClient to interface with MongoDB instead of Mongoose; this iteration will use mongoose to interface instead.
& cleanDB.py cleans up the collection
@dhruvsangamwar dhruvsangamwar requested review from aidenszeto and a team August 15, 2021 04:54
@dhruvsangamwar dhruvsangamwar requested review from KevinYuCode and removed request for a team August 15, 2021 04:54
@aidenszeto aidenszeto requested review from nishantbalaji and removed request for KevinYuCode August 17, 2021 01:12
Copy link
Member

@aidenszeto aidenszeto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good for the most part, just the environment variable notes I mentioned in the comments may need changes. Besides that we should also think about data generation for listings in addition to users, but that can be moved to a different PR


#This is where the database gets seeded

client = MongoClient("mongodb://vhomesgroup:[email protected]:27017,cluster0-shard-00-01.rmikc.mongodb.net:27017,cluster0-shard-00-02.rmikc.mongodb.net:27017/VHomes?ssl=true&replicaSet=atlas-1wcpgc-shard-0&authSource=admin&retryWrites=true&w=majority")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we use the environment variables for this? The coordinates.py file has an example of how to pull from the .env file https://github.com/staynomad/Nomad-Back/blob/master/tools/coordinates.py. We should do the same for the cleanDB.py script

@nishantbalaji nishantbalaji marked this pull request as draft August 31, 2021 00:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Write script to seed database with test data
2 participants