windows下MongoDB入门(二次翻译)

简介:   下载 安装MongoDB最简单的方法(也是推荐方法)是使用编译好的二进制文件。 注意:推荐使用64位版本(尽管这样你必须使用64位系统来运行这个版本)。 下载32-bit binaries 下载64-bit binaries 解压 将下载好的而机制文件解压到你喜欢的任意位置。

 

下载

安装MongoDB最简单的方法(也是推荐方法)是使用编译好的二进制文件。

注意:推荐使用64位版本(尽管这样你必须使用64位系统来运行这个版本)。

下载32-bit binaries


下载64-bit binaries


解压

将下载好的而机制文件解压到你喜欢的任意位置。为了方便,可以把“mongo-xxxxxxx重命名为“mongo

创建数据目录

:MongoDB默认把数据存放在\data\db目录下,但是它不会自动创建这个文件夹。所以我们这样做:

 

C:\> mkdir \data

C:\> mkdir \data\db
 

 

 

当然你也可以通过资源管理器完成。

.如果你想要把数据文件存放在其他位置,打开mongod.exe的时候使用--dbpath命令行参数。

运行并连接到服务器

开始运行时有两个重要文件:

 

 mongod.exe - 数据库服务器。使用mongod –help可以查看启动选项。

 mongo.exe - 管理员命令行。

要运行数据库,从资源管理器或者CMD窗口打开mongod.exe即可。

 

C:\> cd \my_mongo_dir\bin

C:\my_mongo_dir\bin> mongod
注意:本服务器也可以作为Windows服务运行,我们稍候介绍。

 

现在,打开管理员命令行(从资源管理器双击或者使用CMD窗口)。默认地,mongo.exe会运行在localhost上连接到一个mongod服务器并且使用test数据库。可以运行mongo –help查看其他选项。

C:\> cd \my_mongo_dir\bin

C:\my_mongo_dir\bin> mongo
 

 

> // the mongo shell is a javascript shell connected to the db
> // by default it connects to database 'test' at localhost
> 3+3
6
> db
test
> // the first write will create the db:
> db.foo.insert( { a : 1 } )
> db.foo.find()
{ _id : ..., a : 1 }
> show dbs
...
> show collections
...
> help
 

 

Congratulations, 你已经保存和取回你的第一个MongoDB 文档了!

编程

你可以使用MongoDB虚拟任何编程语言写程序。到Drivers页面查看全部语言列表,如果要编写.NET程序也可以到C#页面查看信息。

 

 

目录
相关文章
|
8月前
|
NoSQL IDE MongoDB
Studio 3T 2025.11 (macOS, Linux, Windows) - MongoDB 的终极 GUI、IDE 和 客户端
Studio 3T 2025.11 (macOS, Linux, Windows) - MongoDB 的终极 GUI、IDE 和 客户端
470 3
|
5月前
|
NoSQL IDE MongoDB
Studio 3T 2025.17 (macOS, Linux, Windows) - MongoDB 的终极 GUI、IDE 和 客户端
Studio 3T 2025.17 (macOS, Linux, Windows) - MongoDB 的终极 GUI、IDE 和 客户端
362 1
Studio 3T 2025.17 (macOS, Linux, Windows) - MongoDB 的终极 GUI、IDE 和 客户端
|
8月前
|
NoSQL IDE MongoDB
Studio 3T 2025.10 (macOS, Linux, Windows) - MongoDB 的终极 GUI、IDE 和 客户端
Studio 3T 2025.10 (macOS, Linux, Windows) - MongoDB 的终极 GUI、IDE 和 客户端
716 21
Studio 3T 2025.10 (macOS, Linux, Windows) - MongoDB 的终极 GUI、IDE 和 客户端
|
11月前
|
NoSQL IDE MongoDB
Studio 3T 2025.5 (macOS, Linux, Windows) - MongoDB 的终极 GUI、IDE 和 客户端
Studio 3T 2025.5 (macOS, Linux, Windows) - MongoDB 的终极 GUI、IDE 和 客户端
426 2
Studio 3T 2025.5 (macOS, Linux, Windows) - MongoDB 的终极 GUI、IDE 和 客户端
|
11月前
|
NoSQL IDE MongoDB
Studio 3T 2025.4 (macOS, Linux, Windows) - MongoDB 的终极 GUI、IDE 和 客户端
Studio 3T 2025.4 (macOS, Linux, Windows) - MongoDB 的终极 GUI、IDE 和 客户端
460 0
Studio 3T 2025.4 (macOS, Linux, Windows) - MongoDB 的终极 GUI、IDE 和 客户端
|
存储 NoSQL MongoDB
MongoDB入门级别教程全(Windows版,保姆级教程)
一份全面的MongoDB入门级教程,包括在Windows系统上安装MongoDB、使用MongoDB Shell和Compass GUI进行数据库操作,以及MongoDB的基本数据类型和查询技巧。
3342 5
MongoDB入门级别教程全(Windows版,保姆级教程)
|
NoSQL Shell MongoDB
Windows 平台安装 MongoDB
10月更文挑战第10天
538 0
Windows 平台安装 MongoDB
|
4月前
|
安全 数据安全/隐私保护 虚拟化
Windows Server 2022 中文版、英文版下载 (2025 年 10 月更新)
Windows Server 2022 中文版、英文版下载 (2025 年 10 月更新)
1087 2
Windows Server 2022 中文版、英文版下载 (2025 年 10 月更新)
|
4月前
|
安全 Unix 物联网
Windows 7 & Windows Server 2008 R2 简体中文版下载 (2025 年 10 月更新)
Windows 7 & Windows Server 2008 R2 简体中文版下载 (2025 年 10 月更新)
485 0
Windows 7 & Windows Server 2008 R2 简体中文版下载 (2025 年 10 月更新)
|
4月前
|
存储 SQL 人工智能
Windows Server 2025 中文版、英文版下载 (2025 年 10 月更新)
Windows Server 2025 中文版、英文版下载 (2025 年 10 月更新)
685 0

热门文章

最新文章

推荐镜像

更多