MongoDB and GUI 管理界面

时间:2025-05-07 12:04:02

MongoDB

https://www.mongodb.com/

MongoDB Atlas
Database as a Service

The best way to deploy, operate, and scale MongoDB in the cloud.
Available on AWS, Azure, and Google Cloud Platform

Launch a new app or easily migrate to MongoDB Atlas with zero downtime.

官方指导文档

https://docs.mongodb.com/manual/tutorial/getting-started/

db.collection('inventory').insertMany([
// MongoDB adds the _id field with an ObjectId if _id is not present
{ item: "journal", qty: 25, status: "A",
size: { h: 14, w: 21, uom: "cm" }, tags: [ "blank", "red" ] },
{ item: "notebook", qty: 50, status: "A",
size: { h: 8.5, w: 11, uom: "in" }, tags: [ "red", "blank" ] },
{ item: "paper", qty: 100, status: "D",
size: { h: 8.5, w: 11, uom: "in" }, tags: [ "red", "blank", "plain" ] },
{ item: "planner", qty: 75, status: "D",
size: { h: 22.85, w: 30, uom: "cm" }, tags: [ "blank", "red" ] },
{ item: "postcard", qty: 45, status: "A",
size: { h: 10, w: 15.25, uom: "cm" }, tags: [ "blue" ] }
])
.then(function(result) {
// process result
})

http://www.runoob.com/mongodb/mongodb-create-collection.html

MongoDB 是一个基于分布式文件存储的数据库。由 C++ 语言编写。旨在为 WEB 应用提供可扩展的高性能数据存储解决方案。

MongoDB 是一个介于关系数据库和非关系数据库之间的产品,是非关系数据库当中功能最丰富,最像关系数据库的。

NoSQL(NoSQL = Not Only SQL ),意即"不仅仅是SQL"。

在现代的计算系统上每天网络上都会产生庞大的数据量。

这些数据有很大一部分是由关系数据库管理系统(RDBMS)来处理。 1970年 E.F.Codd's提出的关系模型的论文 "A relational model of data for large shared data banks",这使得数据建模和应用程序编程更加简单。

通过应用实践证明,关系模型是非常适合于客户服务器编程,远远超出预期的利益,今天它是结构化数据存储在网络和商务应用的主导技术。

NoSQL 是一项全新的数据库革命性运动,早期就有人提出,发展至2009年趋势越发高涨。NoSQL的拥护者们提倡运用非关系型的数据存储,相对于铺天盖地的关系型数据库运用,这一概念无疑是一种全新的思维的注入。

命令行

http://www.runoob.com/mongodb/mongodb-connections.html

以下实例我们创建了数据库 runoob:

> use runoob
switched to db runoob
> db
runoob
>

如果你想查看所有数据库,可以使用 show dbs 命令:

> show dbs
admin 0.000GB
local 0.000GB
runoob 0.000GB
>

可以看到,我们刚创建的数据库 runoob 并不在数据库的列表中, 要显示它,我们需要向 runoob 数据库插入一些数据。

> db.runoob.insert({"name":"菜鸟教程"})
WriteResult({ "nInserted" : 1 })
> show dbs
local 0.078GB
runoob 0.078GB
test 0.078GB
>

GUI工具 -- mongo-express

https://www.npmjs.com/package/mongo-express

Web-based MongoDB admin interface written with Node.js, Express and Bootstrap3

Features

  • Connect to multiple databases
  • View/add/delete databases
  • View/add/rename/delete collections
  • View/add/update/delete documents
  • Preview audio/video/image assets inline in collection view
  • Nested and/or large objects are collapsible for easy overview
  • Async on-demand loading of big document properties (>100KB default) to keep collection view fast
  • GridFS support - add/get/delete incredibly large files
  • Use BSON data types in documents
  • Mobile / Responsive - Bootstrap 3 works passably on small screens when you're in a bind
  • Connect and authenticate to individual databases
  • Authenticate as admin to view all databases
  • Database blacklist/whitelist
  • Custom CA and CA validation disabling
  • Supports replica sets

配置设置

http://www.cnblogs.com/xiaohuochai/p/8794687.html

...
if (process.env.VCAP_SERVICES) {
var dbLabel = 'mongodb-2.4';
var env = JSON.parse(process.env.VCAP_SERVICES);
if (env[dbLabel]) {
mongo = env[dbLabel][0].credentials;
}
} else {
mongo = {
db:'blogs',
host:"118.1.1.1",
port:27017,
ssl:false,
username:'blogs',
password:'123456',
url:"mongodb://118.1.1.1:27017/blogs",
// setting the connection string will only give access to that database
// to see more databases you need to set mongodb.admin to true or add databases to the mongodb.auth list
connectionString: process.env.ME_CONFIG_MONGODB_SERVER ? '' : process.env.ME_CONFIG_MONGODB_URL,
};
}
...

访问网页:

MongoDB and GUI 管理界面

GUI工具 -- NoSQL Manager

https://www.mongodbmanager.com/

MongoDB GUI tool with intelligent Shell for you.

NoSQL Manager for MongoDB
Desktop GUI tool for Mongo database management, administration and development.

截图

MongoDB and GUI 管理界面