목차
Create and Alter
Insert
Select
Update Records
Delete Records
데이터 베이스 MySQL 튜토리얼 mongodb安装笔记【服务没有及时响应或控制请求】

mongodb安装笔记【服务没有及时响应或控制请求】

Jun 07, 2016 pm 03:28 PM
mongodb 응답 설치하다 제어 제공하다 메모

mongodb安装笔记 --下面大部分都是参考网上资料,仅仅作为笔记使用 参考链接 Mongodb官网安装 Mongodb官网对比 相关文档 我的mongodb安装在[d:\Java\mongodb] 所以需要根目录手动创建文件夹【e:\data\db】 mongodb使用服务方式安装 D:\Java\mongodb\bin\mong

mongodb安装笔记

--下面大部分都是参考网上资料,仅仅作为笔记使用

参考链接

Mongodb官网安装

Mongodb官网对比

相关文档

我的mongodb安装在[d:\Java\mongodb]

所以需要根目录手动创建文件夹【e:\data\db】

mongodb使用服务方式安装

 'D:\Java\mongodb\bin\mongod.exe --bind_ip 127.0.0.1 --logpath d:\\Java\\mongodb
\\logs\\MongoLog.log --logappend --dbpath d:\\data --directoryperdb --service'
Fri Jan 10 09:17:45.050 Service can be started from the command line with 'net s
tart MongoDB'
로그인 후 복사
日志需要指定具体的文件,比如MongoLog.log 之前没有置顶就报错【服务没有及时响应或控制请求】

安装、删除服务指令

mongod --install

mongod --service

mongod --remove

mongod --reinstall

或者

C:\mongodb\bin\mongod.exe --remove
로그인 후 복사

启动服务

net start Mongodb
로그인 후 복사
停止服务
net stop Mongodb
로그인 후 복사
测试简单JavaScript语句
> 3+3
6

> db
test
> // the first write will create the db:

> db.foo.insert( { a : 1 } )
> db.foo.find()
{ _id : ..., a : 1 }
mongo.exe的详细的用法可以参考mongo.exe --help
로그인 후 복사

下面从官网摘抄下来的普通sql跟MongoDB的区别

Create and Alter

The following table presents the various SQL statements related totable-level actions and the corresponding MongoDB statements.

SQL Schema Statements MongoDB Schema Statements Reference
CREATE TABLE users (
    id MEDIUMINT NOT NULL
        AUTO_INCREMENT,
    user_id Varchar(30),
    age Number,
    status char(1),
    PRIMARY KEY (id)
)
로그인 후 복사

Implicitly created on first insert() operation. The primary key_idis automatically added if_id field is not specified.

db.users.insert( {
    user_id: "abc123",
    age: 55,
    status: "A"
 } )
로그인 후 복사

However, you can also explicitly create a collection:

db.createCollection("users")
로그인 후 복사
Seeinsert() anddb.createCollection()for more information.
ALTER TABLE users
ADD join_date DATETIME
로그인 후 복사

Collections do not describe or enforce the structure of itsdocuments; i.e. there is no structural alteration at thecollection level.

However, at the document level, update() operations can add fields to existingdocuments using the$set operator.

db.users.update(
    { },
    { $set: { join_date: new Date() } },
    { multi: true }
)
로그인 후 복사
See the Data Modeling Concepts, update(), and$set for moreinformation on changing the structure of documents in acollection.
ALTER TABLE users
DROP COLUMN join_date
로그인 후 복사

Collections do not describe or enforce the structure of itsdocuments; i.e. there is no structural alteration at the collectionlevel.

However, at the document level, update() operations can remove fields fromdocuments using the$unset operator.

db.users.update(
    { },
    { $unset: { join_date: "" } },
    { multi: true }
)
로그인 후 복사
See Data Modeling Concepts, update(), and$unset for more information on changing the structure ofdocuments in a collection.
CREATE INDEX idx_user_id_asc
ON users(user_id)
로그인 후 복사
db.users.ensureIndex( { user_id: 1 } )
로그인 후 복사
See ensureIndex()andindexes for more information.
CREATE INDEX
       idx_user_id_asc_age_desc
ON users(user_id, age DESC)
로그인 후 복사
db.users.ensureIndex( { user_id: 1, age: -1 } )
로그인 후 복사
See ensureIndex()andindexes for more information.
DROP TABLE users
로그인 후 복사
db.users.drop()
로그인 후 복사
See drop() formore information.

Insert

The following table presents the various SQL statements related toinserting records into tables and the corresponding MongoDB statements.

SQL INSERT Statements MongoDB insert() Statements Reference
INSERT INTO users(user_id,
                  age,
                  status)
VALUES ("bcd001",
        45,
        "A")
로그인 후 복사
db.users.insert( {
       user_id: "bcd001",
       age: 45,
       status: "A"
} )
로그인 후 복사
See insert() for more information.

Select

The following table presents the various SQL statements related toreading records from tables and the corresponding MongoDB statements.

SQL SELECT Statements MongoDB find() Statements Reference
SELECT *
FROM users
로그인 후 복사
db.users.find()
로그인 후 복사
See find()for more information.
SELECT id, user_id, status
FROM users
로그인 후 복사
db.users.find(
    { },
    { user_id: 1, status: 1 }
)
로그인 후 복사
See find()for more information.
SELECT user_id, status
FROM users
로그인 후 복사
db.users.find(
    { },
    { user_id: 1, status: 1, _id: 0 }
)
로그인 후 복사
See find()for more information.
SELECT *
FROM users
WHERE status = "A"
로그인 후 복사
db.users.find(
    { status: "A" }
)
로그인 후 복사
See find()for more information.
SELECT user_id, status
FROM users
WHERE status = "A"
로그인 후 복사
db.users.find(
    { status: "A" },
    { user_id: 1, status: 1, _id: 0 }
)
로그인 후 복사
See find()for more information.
SELECT *
FROM users
WHERE status != "A"
로그인 후 복사
db.users.find(
    { status: { $ne: "A" } }
)
로그인 후 복사
See find()and$ne for more information.
SELECT *
FROM users
WHERE status = "A"
AND age = 50
로그인 후 복사
db.users.find(
    { status: "A",
      age: 50 }
)
로그인 후 복사
See find()and$and for more information.
SELECT *
FROM users
WHERE status = "A"
OR age = 50
로그인 후 복사
db.users.find(
    { $or: [ { status: "A" } ,
             { age: 50 } ] }
)
로그인 후 복사
See find()and$or for more information.
SELECT *
FROM users
WHERE age > 25
로그인 후 복사
db.users.find(
    { age: { $gt: 25 } }
)
로그인 후 복사
See find()and$gt for more information.
SELECT *
FROM users
WHERE age < 25
로그인 후 복사
db.users.find(
   { age: { $lt: 25 } }
)
로그인 후 복사
See find()and$lt for more information.
SELECT *
FROM users
WHERE age > 25
AND   age <= 50
로그인 후 복사
db.users.find(
   { age: { $gt: 25, $lte: 50 } }
)
로그인 후 복사
See find(),$gt, and $lte formore information.
SELECT *
FROM users
WHERE user_id like "%bc%"
로그인 후 복사
db.users.find(
   { user_id: /bc/ }
)
로그인 후 복사
See find()and$regex for more information.
SELECT *
FROM users
WHERE user_id like "bc%"
로그인 후 복사
db.users.find(
   { user_id: /^bc/ }
)
로그인 후 복사
See find()and$regex for more information.
SELECT *
FROM users
WHERE status = "A"
ORDER BY user_id ASC
로그인 후 복사
db.users.find( { status: "A" } ).sort( { user_id: 1 } )
로그인 후 복사
See find()andsort()for more information.
SELECT *
FROM users
WHERE status = "A"
ORDER BY user_id DESC
로그인 후 복사
db.users.find( { status: "A" } ).sort( { user_id: -1 } )
로그인 후 복사
See find()andsort()for more information.
SELECT COUNT(*)
FROM users
로그인 후 복사
db.users.count()
로그인 후 복사

or

db.users.find().count()
로그인 후 복사
See find()andcount() formore information.
SELECT COUNT(user_id)
FROM users
로그인 후 복사
db.users.count( { user_id: { $exists: true } } )
로그인 후 복사

or

db.users.find( { user_id: { $exists: true } } ).count()
로그인 후 복사
See find(),count(), and$exists for more information.
SELECT COUNT(*)
FROM users
WHERE age > 30
로그인 후 복사
db.users.count( { age: { $gt: 30 } } )
로그인 후 복사

or

db.users.find( { age: { $gt: 30 } } ).count()
로그인 후 복사
See find(),count(), and$gt for more information.
SELECT DISTINCT(status)
FROM users
로그인 후 복사
db.users.distinct( "status" )
로그인 후 복사
See find()anddistinct()for more information.
SELECT *
FROM users
LIMIT 1
로그인 후 복사
db.users.findOne()
로그인 후 복사

or

db.users.find().limit(1)
로그인 후 복사
See find(),findOne(),andlimit()for more information.
SELECT *
FROM users
LIMIT 5
SKIP 10
로그인 후 복사
db.users.find().limit(5).skip(10)
로그인 후 복사
See find(),limit(), andskip() formore information.
EXPLAIN SELECT *
FROM users
WHERE status = "A"
로그인 후 복사
db.users.find( { status: "A" } ).explain()
로그인 후 복사
See find()andexplain()for more information.

Update Records

The following table presents the various SQL statements related toupdating existing records in tables and the corresponding MongoDBstatements.

SQL Update Statements MongoDB update() Statements Reference
UPDATE users
SET status = "C"
WHERE age > 25
로그인 후 복사
db.users.update(
   { age: { $gt: 25 } },
   { $set: { status: "C" } },
   { multi: true }
)
로그인 후 복사
See update(),$gt, and $set for moreinformation.
UPDATE users
SET age = age + 3
WHERE status = "A"
로그인 후 복사
db.users.update(
   { status: "A" } ,
   { $inc: { age: 3 } },
   { multi: true }
)
로그인 후 복사
See update(),$inc, and $set for moreinformation.

Delete Records

The following table presents the various SQL statements related todeleting records from tables and the corresponding MongoDB statements.

본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.

핫 AI 도구

Undresser.AI Undress

Undresser.AI Undress

사실적인 누드 사진을 만들기 위한 AI 기반 앱

AI Clothes Remover

AI Clothes Remover

사진에서 옷을 제거하는 온라인 AI 도구입니다.

Undress AI Tool

Undress AI Tool

무료로 이미지를 벗다

Clothoff.io

Clothoff.io

AI 옷 제거제

AI Hentai Generator

AI Hentai Generator

AI Hentai를 무료로 생성하십시오.

인기 기사

R.E.P.O. 에너지 결정과 그들이하는 일 (노란색 크리스탈)
4 몇 주 전 By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. 최고의 그래픽 설정
4 몇 주 전 By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. 아무도들을 수없는 경우 오디오를 수정하는 방법
4 몇 주 전 By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. 채팅 명령 및 사용 방법
4 몇 주 전 By 尊渡假赌尊渡假赌尊渡假赌

뜨거운 도구

메모장++7.3.1

메모장++7.3.1

사용하기 쉬운 무료 코드 편집기

SublimeText3 중국어 버전

SublimeText3 중국어 버전

중국어 버전, 사용하기 매우 쉽습니다.

스튜디오 13.0.1 보내기

스튜디오 13.0.1 보내기

강력한 PHP 통합 개발 환경

드림위버 CS6

드림위버 CS6

시각적 웹 개발 도구

SublimeText3 Mac 버전

SublimeText3 Mac 버전

신 수준의 코드 편집 소프트웨어(SublimeText3)

LG, 역대급 선명도와 응답속도 갖춘 27인치 480Hz QHD 게이밍 OLED 패널 양산 LG, 역대급 선명도와 응답속도 갖춘 27인치 480Hz QHD 게이밍 OLED 패널 양산 Sep 01, 2024 pm 03:37 PM

최근 LG디스플레이는 27인치 480Hz QHD 게이밍 OLED 패널이 공식 양산에 들어갔다고 발표했다. 이 패널은 OLED 제품 중 새로운 최고 주사율과 응답 속도를 창출했으며, 480Hz 주사율은 이전 기록인 0.03ms보다 한 단계 더 발전된 0.02ms의 GtG 그레이스케일 응답 시간과 결합되어 최고의 경험을 선사합니다. FPS 및 레이싱과 같은 게임 유형에 적합합니다. 새로운 패널은 LG디스플레이의 META 기술을 최적화해 OLED 소재의 발광 효율을 향상시킨다. 이미지 품질이 향상되고 정반사가 크게 감소됩니다. 4면 프레임리스 디자인은 시야를 넓히고 몰입감 있는 경험을 선사합니다. 픽셀 구조 최적화 WRGB 픽셀 구조는 게임 및 문서 편집 요구 사항에 최적화되어 있습니다. 텍스트 표시가 더 선명해졌습니다.

net4.0의 용도는 무엇입니까 net4.0의 용도는 무엇입니까 May 10, 2024 am 01:09 AM

.NET 4.0은 다양한 애플리케이션을 만드는 데 사용되며 객체 지향 프로그래밍, 유연성, 강력한 아키텍처, 클라우드 컴퓨팅 통합, 성능 최적화, 광범위한 라이브러리, 보안, 확장성, 데이터 액세스 및 모바일을 포함한 풍부한 기능을 애플리케이션 개발자에게 제공합니다. 개발 지원.

화웨이의 8월 서비스 데이가 왔습니다: 휴대폰 필름 무료 및 수리 인건비 무료 화웨이의 8월 서비스 데이가 왔습니다: 휴대폰 필름 무료 및 수리 인건비 무료 Aug 07, 2024 pm 07:24 PM

8월 3일자 뉴스에 따르면 화웨이의 공식 소개에 따르면 화웨이의 7월 서비스 데이가 8월 3일부터 8월 4일까지 공식적으로 시작됐다. Huawei의 서비스 날짜는 매월 첫 번째 연속 금요일부터 일요일까지입니다(주말이 해당 달에 걸쳐 있는 경우 다음 주말로 연기됩니다). 행사 기간 동안 매장을 방문하는 화웨이 사용자들은 필름 스티커 무료, 수리 인건비 무료 등 6가지 독점 혜택을 누릴 수 있다. 구체적으로: 화웨이 휴대폰: 무료 필름, 청소, 유지보수 및 시스템 업그레이드 서비스 화웨이 태블릿, 노트북, 웨어러블, 지정 모델의 이어폰, 스마트 안경: 또한 행사 기간 동안 사용자에게 무료로 외관 청소 및 유지보수 서비스가 제공됩니다. 장비 수리를 위해 매장에 갈 필요가 없습니다. 인건비를 지불하고 매장에 가서 Huawei 브랜드 액세서리, 확장 서비스 패키지, 맞춤형 필름 제품을 구매하세요. 수리된 장비는 권장 소매가에서 10% 할인을 받을 수 없습니다. 당일 수리됨.

데비안에서 MongoDB 자동 확장을 구성하는 방법 데비안에서 MongoDB 자동 확장을 구성하는 방법 Apr 02, 2025 am 07:36 AM

이 기사는 데비안 시스템에서 MongoDB를 구성하여 자동 확장을 달성하는 방법을 소개합니다. 주요 단계에는 MongoDB 복제 세트 및 디스크 공간 모니터링 설정이 포함됩니다. 1. MongoDB 설치 먼저 MongoDB가 데비안 시스템에 설치되어 있는지 확인하십시오. 다음 명령을 사용하여 설치하십시오. sudoaptupdatesudoaptinstall-imongb-org 2. MongoDB Replica 세트 MongoDB Replica 세트 구성은 자동 용량 확장을 달성하기위한 기초 인 고 가용성 및 데이터 중복성을 보장합니다. MongoDB 서비스 시작 : sudosystemctlstartMongodsudosys

데비안에서 MongoDB의 고 가용성을 보장하는 방법 데비안에서 MongoDB의 고 가용성을 보장하는 방법 Apr 02, 2025 am 07:21 AM

이 기사는 데비안 시스템에서 고도로 사용 가능한 MongoDB 데이터베이스를 구축하는 방법에 대해 설명합니다. 우리는 데이터 보안 및 서비스가 계속 운영되도록하는 여러 가지 방법을 모색 할 것입니다. 주요 전략 : ReplicaSet : ReplicaSet : 복제품을 사용하여 데이터 중복성 및 자동 장애 조치를 달성합니다. 마스터 노드가 실패하면 복제 세트는 서비스의 지속적인 가용성을 보장하기 위해 새 마스터 노드를 자동으로 선택합니다. 데이터 백업 및 복구 : MongoDump 명령을 정기적으로 사용하여 데이터베이스를 백업하고 데이터 손실의 위험을 처리하기 위해 효과적인 복구 전략을 공식화합니다. 모니터링 및 경보 : 모니터링 도구 (예 : Prometheus, Grafana) 배포 MongoDB의 실행 상태를 실시간으로 모니터링하고

샤오미 추수감사절 이벤트 시작: 80개 휴대폰 모델 배터리 교체 20% 할인, 모든 노트북 시리즈 청소 50% 할인, 49.5위안부터 시작 샤오미 추수감사절 이벤트 시작: 80개 휴대폰 모델 배터리 교체 20% 할인, 모든 노트북 시리즈 청소 50% 할인, 49.5위안부터 시작 Jul 17, 2024 am 07:45 AM

7월 16일 이 사이트의 소식에 따르면 샤오미는 오늘 추수감사절 행사를 시작하여 휴대폰, 노트북, 에어컨, 세탁기, 레인지 후드 및 기타 액세서리에 대한 우선 교체 및 유지 관리 서비스를 제공합니다. 본 사이트에서 정리한 활동 내용은 다음과 같습니다. 이벤트 시간은 2024년 7월 16일 10시부터 2024년 7월 25일 24시까지입니다. 휴대폰 배터리 교체는 80개 모델에 대해 20% 할인된 가격으로 즐기실 수 있습니다. , 공식 품질 및 오리지널 액세서리 포함. 12개 모델은 79.2위안부터 휴대폰 뒷면 커버 교체에 대해 20% 할인을 받을 수 있습니다. 휴대폰 뒷면 커버 교체, 공식 액세서리는 68위안부터 시작됩니다. Xiaomi Mall에서 후면 커버 교체 서비스를 주문하시면 매장에서 색상을 선택할 수 있으며, 특정 재고는 매장의 실제 상황에 따라 달라질 수 있습니다. 선택한 색상이 품절인 경우 배송이 지연될 수 있습니다. 노트북 배터리를 새 배터리로 교체하고 14개 노트북 모델 20% 할인 혜택을 누리세요

Pi Coin의 주요 업데이트 : Pi Bank가오고 있습니다! Pi Coin의 주요 업데이트 : Pi Bank가오고 있습니다! Mar 03, 2025 pm 06:18 PM

Pinetwork는 혁신적인 모바일 뱅킹 플랫폼 인 Pibank를 출시하려고합니다! Pinetwork는 오늘 Pibank라고 불리는 Elmahrosa (Face) Pimisrbank에 대한 주요 업데이트를 발표했습니다. Pibank는 Pinetwork Cryptocurrency 기능을 완벽하게 통합하여 화폐 통화 및 암호 화폐의 원자 교환을 실현합니다 (US Dollar, Indones rupiah, indensian rupiah and with rupiah and and indensian rupiah and rupiah and and Indones rupiah and rupiahh and rupiah and rupiah and rupiah and rupiah and rupiah and rupiah and rupiah cherrenciance) ). Pibank의 매력은 무엇입니까? 알아 보자! Pibank의 주요 기능 : 은행 계좌 및 암호 화폐 자산의 원 스톱 관리. 실시간 거래를 지원하고 생물학을 채택하십시오

MongoDB 데이터베이스 비밀번호를 보는 Navicat의 방법 MongoDB 데이터베이스 비밀번호를 보는 Navicat의 방법 Apr 08, 2025 pm 09:39 PM

해시 값으로 저장되기 때문에 MongoDB 비밀번호를 Navicat을 통해 직접 보는 것은 불가능합니다. 분실 된 비밀번호 검색 방법 : 1. 비밀번호 재설정; 2. 구성 파일 확인 (해시 값이 포함될 수 있음); 3. 코드를 점검하십시오 (암호 하드 코드 메일).

See all articles
SQL Delete Statements MongoDB remove() Statements Reference
DELETE FROM users
WHERE status = "D"
로그인 후 복사
db.users.remove( { status: "D" } )
로그인 후 복사
See remove()for more information.
DELETE FROM users
로그인 후 복사
db.users.remove( )
로그인 후 복사
See remove()for more information.