{ artists:
{ id: '324435',
name: 'Gleen'
},
albums:
[ { album: [Object], tracks: [Object] },
{ album: [Object], tracks: [Object] },
{ album: [Object], tracks: [Object] },
{ album: [Object], tracks: [Object] },
{ album: [Object], tracks: [Object] },
{ album: [Object], tracks: [Object] },
{ album: [Object], tracks: [Object] },
{ album: [Object], tracks: [Object] } ] }
如何在mongoose中声明架构以便我可以保存到mongodb?键入:普通对象值的字符串,但它是一个对象数组呢?
答案 0 :(得分:1)
Schema @zangw回答也有效,但这是另一种方法。
$.ajax({
url: post_http_site,
type: "POST",
data: JSON.parse(JSON.stringify(Json_PostData)),
cache: false,
error: function (xhr, ajaxOptions, thrownError) {
alert(" write json item, Ajax error! " + xhr.status + " error =" + thrownError + " xhr.responseText = " + xhr.responseText );
},
success: function (data) {
alert("write json item, Ajax OK");
}
});