mongodb for windows

Posted wsjun

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mongodb for windows相关的知识,希望对你有一定的参考价值。

---恢复内容开始---

1,可以去mongodb.com 官网下载mongodb

安装方法 这里就不介绍了

2, 在安装目录下新增mongod.cfg,内容如下

systemLog:
    destination: file
    path: f:mongodbdblogmongod.log
storage:
    dbPath: f:datadb

 

3, 安装完以后,打开安装位置的bin目录,打开命令提示符

输入mongo  出现一下提示表示成功,如果失败 在bin目录下尝试修复:mongod --repair 

如果还是失败,那么就是路径设置有问题,通过重新对路径的设置解决此问题 mongod --dbpath=f:mongodb/data/db/    

 

F:mongodbdbin>mongo
MongoDB shell version v4.0.2
connecting to: mongodb://127.0.0.1:27017
MongoDB server version: 4.0.2
Server has startup warnings:
2018-09-19T20:47:40.889+0800 I CONTROL  [initandlisten]
2018-09-19T20:47:40.891+0800 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.
2018-09-19T20:47:40.892+0800 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.
2018-09-19T20:47:40.893+0800 I CONTROL  [initandlisten]
2018-09-19T20:47:40.893+0800 I CONTROL  [initandlisten] ** WARNING: This server is bound to localhost.
2018-09-19T20:47:40.894+0800 I CONTROL  [initandlisten] **          Remote systems will be unable to connect to this server.
2018-09-19T20:47:40.897+0800 I CONTROL  [initandlisten] **          Start the server with --bind_ip <address> to specify which IP
2018-09-19T20:47:40.898+0800 I CONTROL  [initandlisten] **          addresses it should serve responses from, or with --bind_ip_all to
2018-09-19T20:47:40.900+0800 I CONTROL  [initandlisten] **          bind to all interfaces. If this behavior is desired, start the
2018-09-19T20:47:40.900+0800 I CONTROL  [initandlisten] **          server with --bind_ip 127.0.0.1 to disable this warning.
2018-09-19T20:47:40.901+0800 I CONTROL  [initandlisten]
---
Enable MongoDBs free cloud-based monitoring service, which will then receive and display
metrics about your deployment (disk utilization, CPU, operation statistics, etc).

The monitoring data will be available on a MongoDB website with a unique URL accessible to you
and anyone you share the URL with. MongoDB may use this information to make product
improvements and to suggest MongoDB products and deployment options to you.

To enable free monitoring, run the following command: db.enableFreeMonitoring()
To permanently disable this reminder, run the following command: db.disableFreeMonitoring()
---

 

4,这是就可以输入db 看一下当前操作的数据库

db.firstdbdemo.insert({x:10})  可以对数据库增加一条信息
db.firstdbdemo.find()  查看
> db
test
> db.firstdbdemo.insert({x:10})
WriteResult({ "nInserted" : 1 })
> db.firstdbdemo.find()
{ "_id" : ObjectId("5ba2463de89c59c4815018f9"), "x" : 10 }
>
 先写这么多吧。。后期有时间再补。太累了。。。

---恢复内容结束---

以上是关于mongodb for windows的主要内容,如果未能解决你的问题,请参考以下文章

WSL(Windows Subsystem for Linux)的安装与使用及 mongodb安装

如何在 Toad for Oracle 中使用自定义代码片段?

mongodb 管理工具 for mac

codeblock代码片段

NoSQL Manager for MongoDB 4.6.0.3 带key

Client / Server Interoperability Support Matrix for Different Oracle Versions (Doc ID 207303.1)(代码片段