graphql + flutter
[mongodb] collection
으누아빠
2023. 11. 7. 22:46
반응형
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()
document 추가
db.collection.insert({"score": 80, "indexRating": {"index": "tomato", "rate": 7.8}})