win10下,安装moogose环境

第一步:下载moogose安装包
moogose官方下载

第二步:测试是否启动了moogose
以管理员身份打开命令行,cd 到安装目录的 bin 文件夹下

F:\MongoDB\Server\4.0\bin>net start mongodb
请求的服务已经启动。

请键入 NET HELPMSG 2182 以获得更多的帮助。

打开浏览器,搜索

http://localhost:27017/

页面显示:
It looks like you are trying to access MongoDB over HTTP on the native driver port.

第四步:创建数据库
以管理员身份打开命令行,cd 到安装目录的 bin 文件夹下

F:\MongoDB\Server\4.0\bin>mongo
> show dbs
admin   0.000GB
config  0.000GB
local   0.000GB
> use happy_come_healthy
switched to db happy_come_healthy
> db.createCollection('happy_come_healthy')
{ "ok" : 1 }
> show dbs
admin               0.000GB
config              0.000GB
happy_come_healthy  0.000GB
local               0.000GB
>

注意:当你使用“use happy_come_healthy”切换到名为happy_come_healthy的数据库时,实际上什么也没发生,只有当你调用了db.createCollection之后,新的数据库才被保存,然后你使用“show dbs”就可以看到新建的库。

删除数据库
删除数据库需要切换到指定的库,然后调用dropDatabase()。如下:

> show dbs
admin               0.000GB
config              0.000GB
happy_come_healthy  0.000GB
local               0.000GB
> use happy_come_healthy
switched to db happy_come_healthy
> db.dropDatabase()
{ "dropped" : "happy_come_healthy", "ok" : 1 }
> show dbs
admin   0.000GB
config  0.000GB
local   0.000GB
>

参考资料:
Node.js开发入门——MongoDB与Mongoose
MongoDB4.0在windows下的安装与服务配置

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值