mongodb2 [MongoDB] Index 걸기 및 주의사항 Index index 확인 > db.users.getIndexes(); db.users.createIndex({name: 1}) 백그라운드 옵션: {background: true} 이미 데이터가 많은 경우 인덱스를 생성하는 과정에서 오랜 시간이 소요될 수 있음 > db.users.createIndex({name: 1}, {background: true}) 고유 인덱스 생성: {unique: true} 중복 데이터가 생성되지 못하도록 함. 데이터 저장과 검색속도 향상에 도움이 됨. > db.. 2022. 2. 24. [MongoDB] 기본 CRUD 방법과 예시 데이터베이스 전환 > use test;현재 데이터베이스에 만들어진 db의 목록 > show dbs;컬렉션 조회 > show collections;mongodb에서 간단한 자바스크립트 명령어 실행 > var a = {age: 25}; > var n = {name: 'Ed', lang: ['c','ruby','js']}; > for(i=0; i db.scores.save({a:99}); db.scores.insertOne({a:99}); < { acknowledged: true, < insertedId: ObjectId("61fc8b4680b436f.. 2022. 2. 4. 이전 1 다음