음악이라는 내 mongo 데이터베이스에 다음 개체가 있습니다.
나는 장르가 그런
입니다 업데이트 할 밴드 이름은 너바나
입니다 앨범 이름은 트랙 순서는 1
MongoDB 딥 배열 업데이트
트랙의 이름을 변경할 수 있습니다에 "하이틴 성령 냄새가 신경 끄시 고
입니다 ! ".
나는 위치 연산자를 사용하여 연주 해 보았지만, 실제로는 이것을 계산할 수 없습니다.
{
genre : "Grunge",
bands : [ {
name : "Nirvana",
albums : [ {
name : "Nevermind",
tracks : [ {
name : "Smell Like Teen Spirit",
order : 1,
duration : 301
},
{
name : "In Bloom",
order : 2,
duration : 254
} ]
},
{
name : "In Utero",
tracks : [ {
name : "Server the Servants",
order : 1,
duration : 216
},
{
name : "Scentless Apprentice",
order : 2,
duration : 254
} ]
} ]
},
{
name : "Karma++ : A Nirvina Tribute Band",
albums : [ {
name : "Nevermind",
tracks : [ {
name : "Smell Like Teen Spirit",
order : 1,
duration : 301
},
{
name : "In Bloom",
order : 2,
duration : 254
} ]
},
{
name : "In Utero",
tracks : [ {
name : "Server the Servants",
order : 1,
duration : 216
},
{
name : "Scentless Apprentice",
order : 2,
duration : 254
} ]
} ]
} ]
}
DB 디자인을 조금 변경하셨습니까? 문서가 '장르'속성을 가진 '밴드'인 경우 더 이해할 수 있습니다.이 특정 검색어를 훨씬 쉽게 만들 수도 있습니다. – Russell
이것은 내가 생각할 수있는 가장 빠른 예일뿐입니다. 실제로 '음악'데이터베이스를 만들려면 아마 곡을 아티스트, 앨범 및 장르가 포함 된 루트 요소로 배열로 설정해야합니다. David Bowie/Queen 's 'Under Pressure'(2 명의 아티스트, 여러 앨범)와 같은 것들을 허용합니다. – JWally