0
많은 선택적 속성이 포함 된 다소 복잡한 문서가 있으므로 전체 문서를 업데이트하는 것이 좋습니다.Model.update : 초기 빈 배열이 제대로 업데이트되지 않습니다.
그러나 처음에는 배열에 문제가 있습니다.
부분 모델 :
description: [{
heading: String,
text: String
}],
images: [{
title: String,
description: String,
type: String,
url: String
}],
초기 값 : 이미지
description: [{
heading: 'some heading',
text: 'some text'
}],
images: [],
추가 다음 개체 :
{
description: "img text"
title: "img title"
type: "image/jpeg"
url: "http://mybucket.amazonaws.com/images/img.jpg"
}
과 함께 업데이트 :
Paths.update(path, function(err, numberAffected, raw) {
...
}
업데이트 :에
{
customer_id: '52e1fa1b853285b2ad828152',
name: 'Whitehorse Historic Buildings',
polyline:
[ [ 60.720551, -135.055365 ],
[ 60.720551, -135.055365 ],
...
[ 60.72057, -135.055426 ],
[ 60.720561, -135.055407 ] ],
poi:
[ { name: 'Donnenworth House',
latitude: 60.72053,
longitude: -135.0555,
audios: [],
videos: [],
images: [],
description: [],
streetview: [Object] },
{ name: 'Roundhouse',
latitude: 60.72161,
longitude: -135.0509,
audios: [],
videos: [],
images: [],
description: [],
streetview: [Object] },
{ name: 'White Pass & Yukon Route Building',
latitude: 60.72015,
longitude: -135.0499,
audios: [],
videos: [],
images: [],
description: [],
streetview: [Object] },
{ name: 'Berrigan Cabins',
latitude: 60.71848,
longitude: -135.0501,
audios: [],
videos: [],
images: [],
description: [],
streetview: [Object] },
{ name: 'Log Skyscrappers',
latitude: 60.71804,
longitude: -135.0525,
audios: [],
videos: [],
images: [],
description: [],
streetview: [Object] },
{ name: 'Old Log Church',
latitude: 60.71828,
longitude: -135.0541,
audios: [],
videos: [],
images: [],
description: [],
streetview: [Object] },
{ name: 'Taylor House',
latitude: 60.71889,
longitude: -135.058,
audios: [],
videos: [],
images: [],
description: [],
streetview: [Object] },
{ name: 'McKinnon House',
latitude: 60.71973,
longitude: -135.0607,
audios: [],
videos: [],
images: [],
description: [],
streetview: [Object] },
{ name: 'Captain Martin House',
latitude: 60.72051,
longitude: -135.0561,
audios: [],
videos: [],
images: [],
description: [],
streetview: [Object] } ],
audios: [],
videos: [],
images:
[ { title: 'img title',
description: 'img desc',
type: 'image/jpeg',
url: 'http://mybucket.s3.amazonaws.com/images/52e1fa1b853285b2ad828152-Whitehorse Historic Buildings-img.jpg' } ],
description:
[ { heading: 'Whitehorse Historic Buildings',
text: 'A historical walking tour offered by the Yukon Historical & Museums Association' } ] }
결과 :
"images" : [ "[object Object]" ],
내가 추가 할 수있어 업데이트는 처음에 비어 있지 않은 설명 배열에 객체 경로는 .
내가 잘못하고있는 것이 있거나 버그처럼 들리니?
업데이트 쿼리를 표시 할 수 있습니까? (더 많은 컨텍스트 제공) – Rishi
내 업데이트를 참조하십시오. – bardu
'update'는 콜백 전에 두 개의 매개 변수가 필요합니다. 너는 단 하나! – heinob