victoria
victoria

Reputation: 23

sending data from html form to mongodb database

Im trying to send data to a local mongo database that i've got, but im not entirely sure why its not sending anything. I'd like to send the form data to the database. The idea is that its meant to send the form data over to the mongo database to be stored under the fields from the register.

Upvotes: 0

Views: 466

Answers (1)

郑旭阳
郑旭阳

Reputation: 91

If you are doing read or write operation in control.js, your mongo connection mongoose.connection() should be in control.js and it seems you are not using the url to connect to mongodb. And what is the output in control.js console.log(htask);

And if you would like to find one doc, if found return the doc if not found add one doc, you can use {upsert:true,returnNewDocument:true} in options.

Upvotes: 1

Related Questions