문제

As an example, I have a document with nested custom metadata like:

owner: {"id":"12345"}

I've tried to find this document with:

docpad.getCollection("documents").findAll({
    "owner.id": "12345"
});

but to no avail.

What have I done wrong?

도움이 되었습니까?

해결책

Nested queries aren't supported by default, as it is a tricky thing to do.

For now, you should be able to do this:

CoffeeScript:

docpad.getCollection("documents").findAll({
    "owner": ({id}) -> id is "12345"
})

JavaScript:

docpad.getCollection("documents").findAll({
    "owner": function(model){ return model.id === "12345" }
})
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top