0

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?

Kenny Ki
  • 3,400
  • 1
  • 25
  • 30

1 Answers1

2

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" }
})
balupton
  • 47,113
  • 32
  • 131
  • 182