简体   繁体   中英

Access MongoDB using Nodejs

I have an HTML 5 / Javscript application saves data in MongoDB using C# web services. I believe we can access MongoDB using Node js . SO this is like accessing MongoDB using javscript. How do I invoke the data-access script from the frontend, say on click of a button. Right now, this button click invokes a C# web service. I can run the data-access script in the unix terminal after typing node and then the script name. But how do I bridge the gap between my frontend and backend; bring the two under one ecosystem ? On click of a button, this script (that acsesses mongodb) needs to be invoked.

I think you can refer to javascript - Connecting MongoDB to the front-end? - Stack Overflow

Philipp has good explanation xD

Just to add a little bit on why you can't use your MongoDB (or DB) from frontend .

You'll need a driver to connect, and that's not included in your web browsers js engine.

Know more:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM