공부/MongoDB
-
[MongoDB] 데이터 삽입 및 조회공부/MongoDB 2022. 1. 2. 22:37
1. mongo.exe 실행 show dbs : 존재하는 database를 조회 use databaseName : database에 connect하는 명령어. shop이라는 database가 없더라도 data를 insert하는 순간부터 shop 이라는 database가 생성됨 db.collectionName.insertOne( ) : 현재 연결된 db의 collectionName에 1개의 document를 삽입 document 삽입 시 key값에는 " "를 생략해도 됨 db.collectionName.find( ) : collectionName의 데이터 조회 db.collectionName.find( ).pretty( ) : collectionName의 데이터를 예쁘게 조회하는 명령어. 시각화해서 보기 ..
-
MongoDB 공부 시작~!공부/MongoDB 2022. 1. 2. 02:27
[ MongoDB 구조 ] Database - Collections - Documents (JSON(BSON)형식) Documents를 JSON 형식으로 작성하면 MongoDB server가 BSON으로 변환하여 저장함 Collection은 SQL 기반의 데이터베이스와 달리 schemaless 이므로 flexibility👍 [ MongoDB 설치 ] https://www.mongodb.com/ 에서 Community Server 설치 나는 윈도우 유저여서 윈도우 버전 설치~! 설치 완료! MongoDB Server가 자동으로 실행되는 것을 확인함 이제 MongoDB client를 실행시켜보자 MongoDB가 설치된 폴더의 bin 폴더에서 mongo.exe를 실행시키면 된다. 편의성을 위해 MongoDB ..