전체 글
-
[MongoDB] find( )공부/MongoDB 2022. 1. 9. 21:42
collection에 insertMany( )를 통해 여러개의 document를 삽입 후 find( ).pretty( )를 통해 조회해보면 모든 데이터가 조회되지 않음을 확인할 수 있다. find( ) 명령어 사용 시, shell에서는 기본적으로 20개의 document만 화면에 보여주고 cursor를 반환한다. it 명령어를 치면 나머지 데이터를 조회할 수 있다. find( ).toArray( ) 메소드 사용 시: 모든 document를 fetch하여 배열로 반환함 find( ).forEach( ) : 모든 document에 접근하여 사용자가 지정한 명령을 수행함. 아래에서는 printjson( ) 명령어를 수행한 것임 findOne( ).pretty( ) 가 에러나는 이유: findOne( )은 cu..
-
[MongoDB] CRUD Operations공부/MongoDB 2022. 1. 9. 19:24
Create insertOne(data, options) 👉 하나의 document를 삽입함 insertMany(data, options) 👉 여러 document를 삽입함 Read find(filter, options) 👉 collection의 모든 document를 조회함 findOne(filter, options) 👉 filter를 만족하는 첫번째 document를 조회함 Update updateOne(filter, data, options) 👉 filter를 만족하는 첫번째 document를 수정함 updateMany(filter, data, options) 👉 filter를 만족하는 모든 document를 수정함 replaceOne(filter, data, options) 👉 filter를 만족..
-
[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 ..
-
w3schools - sql exercise (1)공부/PS ( SQL) 2021. 11. 30. 01:04
SELECT * FROM Customers WHERE NOT CITY = 'Berlin' SELECT * FROM Customers ORDER BY Country, City 참고) SELECT * FROM table_name ORDER BY column1, column2 DESC column1 기준 오름차순 정렬 후 column2 기준 내림차순 정렬 INSERT Customers ( CustomerName, Address, City, PostalCode, Country ) VALUES ( 'Hekkan Burger', 'Gateveien 15', 'Sandnes', '4306', 'Norway' ) ; UPDATE Customers SET City = 'Oslo'; DELETE FROM Customers..