Menu
×
   ❮     
HTML CSS JAVASCRIPT SQL PYTHON JAVA PHP HOW TO W3.CSS C C++ C# BOOTSTRAP REACT MYSQL JQUERY EXCEL XML DJANGO NUMPY PANDAS NODEJS R TYPESCRIPT ANGULAR GIT POSTGRESQL MONGODB ASP AI GO KOTLIN SASS VUE DSA GEN AI SCIPY AWS CYBERSECURITY DATA SCIENCE
     ❯   

Node.js MongoDB


Node.js 可用于数据库应用程序。

MongoDB 是最流行的 NoSQL 数据库之一。


MongoDB

为了能够试验代码示例,您需要访问 MongoDB 数据库。

您可以在 https://www.mongodb.com 下载免费的 MongoDB 数据库。

或者直接使用 MongoDB 云服务:https://www.mongodb.com/cloud/atlas


安装 MongoDB 驱动程序

让我们尝试使用 Node.js 访问 MongoDB 数据库。

要下载并安装官方 MongoDB 驱动程序,请打开命令终端并执行以下操作

下载并安装 mongodb 包

C:\Users\您的用户名>npm install mongodb

现在您已下载并安装了 mongodb 数据库驱动程序。

Node.js 可以使用此模块来操作 MongoDB 数据库

var mongo = require('mongodb');

×

Contact Sales

If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail:
[email protected]

Report Error

If you want to report an error, or if you want to make a suggestion, send us an e-mail:
[email protected]

W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookie and privacy policy.

Copyright 1999-2024 by Refsnes Data. All Rights Reserved. W3Schools is Powered by W3.CSS.