Tag: The source Path command executes Ash CTI requires a folder query
1. Start the MongoDB server
Locate the installation directory under the Bin folder and execute the following command
# 默认路径(安装路径\data\db),默认端口(27017)mongod.exe# 如果需要改变数据库路径和端口则改为mongod.exe --dbpath D:\mongodb\data --port 10086# 修改了启动端口,连接的时候也要指明端口mongo.exe# 连接从10086端口启动的mongoDB数据库
2. Operational database
View all Databases
show dbs
View the current database
db
Create/Switch database
use# 不存在则创建,存在则切换到该数据库
Create a collection for a database
db.createCollection("collectionName")
inserting a document
into the collection
db.collectionName.insert({"key":"value"})
querying a document in a collection
db.collectionName.findOne# 返回集合中的第一条文档db.collectionName.find# 返回集合中的所有文档
Delete all documents in the collection
db.collectionName.remove({})
Start and operate MongoDB (CLI) under Windows