Hey Shruti, thanks for the message! As a preview feature this is a bit of a moving target, so I appreciate the heads up. I ran through the tutorial again and was getting the same issue.
There were a couple things that I noticed were causing problems, but I believe I've now got the tutorial sorted out. Try running through it again with a fresh project and database and let me know if you are still having the same problem.
The things I changed:
The schema was using the deprecated dbgenerated() function, instead it should be the auto() function introduced in Prisma 3.10.0.
Right after setting your environment variable in .env, run yarn prisma db push. This will create a collection in the database that matches the name of the model, in this case Post.
The mongosh command was using db.post.insertOne instead of db.Post.insertOne causing a second collection to be created with different casing.
Incorrect casing on the collection may have also been a problem when seeding through the Railway dashboard, but that should also be fixed as long as you run yarn prisma db push before trying to add any data through the dashboard.
If you can't get one method of seeding to work then give the other one a try. But they should both return data if you follow the steps outlined in the article right now. Hope that helps!
Hey Shruti, thanks for the message! As a preview feature this is a bit of a moving target, so I appreciate the heads up. I ran through the tutorial again and was getting the same issue.
There were a couple things that I noticed were causing problems, but I believe I've now got the tutorial sorted out. Try running through it again with a fresh project and database and let me know if you are still having the same problem.
The things I changed:
dbgenerated()
function, instead it should be theauto()
function introduced in Prisma 3.10.0..env
, runyarn prisma db push
. This will create a collection in the database that matches the name of the model, in this casePost
.mongosh
command was usingdb.post.insertOne
instead ofdb.Post.insertOne
causing a second collection to be created with different casing.yarn prisma db push
before trying to add any data through the dashboard.If you can't get one method of seeding to work then give the other one a try. But they should both return data if you follow the steps outlined in the article right now. Hope that helps!
I cannot thank you enough for this. It worked! Thank you so much Anthony :D
Yay! Glad I could help 😊.