MongoDB
[TIL] mongoose(몽고디비) dot notation, filtered positional operator
dot notation 몽고 디비의 dot notation이란 중첩된 객체의 필드를 참조할 때 사용한다 viewCount 배열이 아래와 같음 viewCout: [ {site:’hihi’, count:21}, {site:’aaaa, count:21}, {site:’bbbb, count:21}, ] findOneAndUpdate( {_id': id, 'viewCount.site': ‘hihi’ },{//여기 update query }) 여기서 viewCount.site가 dot notation을 사용한 부분인데 (그냥 점 말하는 듯) 따라서 위 쿼리는 _id:가 id이고 site가 ‘hihi’인 문서를 찾아서 update하는 쿼리이다 filtered positional operator $[elem]이렇게 사..