mongodb 7

[mongodb] 문자열 like 문

``` 문자열 조회 db.getCollection('collection명').find({'컬럼명': /문자열/i }) 컬럼명 값에 '문자열1' 을 포함하고, '문자열2' 을 포함하지 않는 도큐먼트를 조회 db. getCollection('collection명') .find({'컬럼명': {'$regex': /문자열1/i, '$not': /문자열2/i}}) 컬럼명 값에 '문자열'로 시작하는 문자열을 포함하는 도큐먼트를 조회 db. getCollection('collection명') .find({'컬럼명 ': /^문자열 /i }) 컬럼명 값에 '문자열'으로 끝나는 문자열을 포함하는 도큐먼트를 조회 db. getCollection('collection명') .find({'컬럼명 ': /문자열 $/i }) ```

graphql + flutter 2024.01.27

[mongodb] 단일 삭제(deleteOne), 다수 삭제(deleteMany)

삭제 단일 문서 삭제 db.collection.deleteOne({ 조건 }); 여러 문서 삭제 db.collection.deleteMany({ 조건 }); db.collection.deleteOne({name: "홍길동"}); //name이 홍길동인 document 삭제 db.collection.deleteOne({}); // 한개삭제 처음 도큐먼트 한개를 삭제하는 명령이다. db.collection.deleteMany({name: "홍길동"});// name이 '홍길동'인 document 모두삭제 db.collection.deleteMany({}); // 모두 삭제

graphql + flutter 2023.12.24

[mongodb] 데이터 조회,논리검색

전체 조회 db.collection 명.find();조건 검색 db.collection 명.find({"필드명": "검색"});논리 검색 db.collection 명.find({ $or: [ { "필드명": "검색어" }, { "필드명": "검색어" } ] }) // OR 검색 db.collection 명.find({ $and: [ { "필드명": "검색어" }, { "필드명": "검색어" } ] }) // AND 검색 db.collection 명.find({ $not: [ { "필드명": "검색어" }, { "필드명": "검색어" } ] }) // 하나라도 만족하지 않는 조건검색 db.collection 명.find({ $nor: [ { "필드명": "검색어" }, { "필드명": "검색어" } ] }..

graphql + flutter 2023.12.15

[mongodb] collection

collection 생성 db.createCollection(collection, [options]) db.createCollection(collection, { capped:false, autoIndexId: true }) capped : 컬렉션의 고정 크기 지정하여 초과하면 오래된 데이터 부터 제거 true 로 설정하면 size 값 설정 필요 타입: Boolean 기본값:false size : capped 값이 true 일경우 collection 의 최대 크기 지정(byte) max : collection 에 추가할수 있는 최대 document 값 autoIndexId : _id 필드에 index를 자동생성 기본값: false collection 삭제 db.collection.drop()documen..

graphql + flutter 2023.11.07