안녕하세요 저는 콧수염에 처음 왔고 최근에 놀아 왔습니다.Moustache.js와 mongodb의 bson 데이터에있는 목록
나는 단순함을 좋아하고 어떻게 프레젠테이션에 중점을 둡니다. 아니 논리!
node.js에서 mongodb와 mongoose를 사용할 때 products라는 컬렉션을 요구하고 있습니다. 현재 컬렉션의 모든 문서를 매우 작게 받고 있습니다.
이 데이터를 표시 할 때 콧수염의 목록 기능을 사용하고 싶습니다.
<script id="listTemplate" type="text/html" >
{{#.}}
<div class="singleItem">
<div class="title">{{title}}</div>
<div class="description">{{description}}</div>
</div>
{{/.}}
</script>
내가 사용하고있어 BSON 응답은 다음과 같습니다
[
{
"title": "item",
"description": "All about the details. Of course it's black.",
"style": "12345",
"_id": "5116874d2ac8dc2804000001",
"__v": 0,
"modified": "2013-02-09T17:28:45.000Z"
},
{
"title": "item",
"description": "All about the details. Of course it's black.",
"style": "12348",
"_id": "511688222ac8dc2804000003",
"__v": 0,
"modified": "2013-02-09T17:32:18.000Z"
}
]
결과가 배열 인, 콧수염이 템플릿 배열의 이름을 기대? 올바른 구문으로 콧수염 주머니에 BSON을 똑바로 펀치 할 수 있습니까?
대안으로 mongo의 응답에 배열 이름을 추가 할 수 있습니까? 또는 심지어 노드를 통해. {{arrayname}} {{arrayname}}
Thanks! 위대한 작품! :) –