-
[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가 schemaless하다는 것을 확인할 수 있다
'공부 > MongoDB' 카테고리의 다른 글
[MongoDB] find( ) (0) 2022.01.09 [MongoDB] CRUD Operations (0) 2022.01.09 [MongoDB] document의 _id를 지정해서 데이터 삽입하기 (0) 2022.01.03 [MongoDB] MongoDB 서버 실행 (0) 2022.01.02 MongoDB 공부 시작~! (0) 2022.01.02