Skip to content
This repository has been archived by the owner on Aug 6, 2023. It is now read-only.

how to seeding the database #4

Open
ahmadxgani opened this issue Feb 5, 2023 · 2 comments
Open

how to seeding the database #4

ahmadxgani opened this issue Feb 5, 2023 · 2 comments

Comments

@ahmadxgani
Copy link

I tried to look at the seed-data folder in the repository and I think it's a dummy data used for seeding MongoDB documents, but I'm not quite sure. If that's correct, how do I import the data into the MongoDB database? I'm not very familiar with MongoDB, I previously used SQL.

@ahmadxgani
Copy link
Author

i tried to run mongorestore --uri "mongodb://root:password@localhost:23086/example?authSource=admin" --dir ./backend/seed-data/

but there has been no change at all:

2023-02-07T15:54:26.195+0700    The --db and --collection flags are deprecated for this use-case; please use --nsInclude instead, i.e. with --nsInclude=${DATABASE}.${COLLECTION}
2023-02-07T15:54:26.195+0700    building a list of collections to restore from backend/seed-data dir
2023-02-07T15:54:26.195+0700    don't know what to do with file "backend/seed-data/cartitems", skipping...
2023-02-07T15:54:26.195+0700    don't know what to do with file "backend/seed-data/db.dump", skipping...
2023-02-07T15:54:26.195+0700    don't know what to do with file "backend/seed-data/orderitems", skipping...
2023-02-07T15:54:26.195+0700    don't know what to do with file "backend/seed-data/orders", skipping...
2023-02-07T15:54:26.195+0700    don't know what to do with file "backend/seed-data/productimages", skipping...
2023-02-07T15:54:26.195+0700    don't know what to do with file "backend/seed-data/products", skipping...
2023-02-07T15:54:26.195+0700    don't know what to do with file "backend/seed-data/roles", skipping...
2023-02-07T15:54:26.195+0700    don't know what to do with file "backend/seed-data/system.users", skipping...
2023-02-07T15:54:26.195+0700    don't know what to do with file "backend/seed-data/system.version", skipping...
2023-02-07T15:54:26.195+0700    don't know what to do with file "backend/seed-data/users", skipping...
2023-02-07T15:54:26.196+0700    0 document(s) restored successfully. 0 document(s) failed to restore.

@sophiabrandt
Copy link
Owner

Ah, sorry, I haven't touched this repo in years, so I'm not sure anymore.

But you're correct, I used mongodump and mongorestore for that. I think I ran it inside docker, as I don't have the mongo command line tool installed on my computer.

Maybe this helps: https://dev.to/mkubdev/mongodump-and-mongorestore-with-docker-39m7

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants