kinngh / shopify-node-express-mongodb-app

An embedded Shopify app starter template made with Node, Express, React and Vite, with all the required stuff hooked up.
https://x.com/kinngh
MIT License
295 stars 101 forks source link

Model.findOneAndUpdate is not a function - Once again user error #67

Closed ohermans1 closed 1 year ago

ohermans1 commented 1 year ago

Hey mate,

Thanks so much for your help a few days ago, and I'm sorry for pestering you again (last time I promise). Feel free to just ignore me and mark this as solved if you can't be bothered responding haha.

Basically, I'm trying to add some content to MongoDB.

I can see that your inbuild models are connecting up with no issues:

image

I created a new model, based of your original ones:

image

Then I run it as per your models as well (using findOneAndUpdate)

image

But, for some reason I get the following error:

image

Do you have any tips or tricks? I'm imagining there is something simple I'm missing here!

kinngh commented 1 year ago

Are you trying to run mongoose on react side of things? If yes, please, and don't take this lightly, go back to tutorials and understand why you shouldn't be making database calls directly from your frontend and it should be from your server instead.