collections:
posts: ->
# @getCollection('documents').findAllLive({relativeDirPath: 'posts'}, [date: -1])
@getCollection('documents').findAllLive({relativeDirPath: {'$in' : ['posts', /post\/[0-9]+/ ]}}, [date: -1])
In the main docpad.coffee
, {relativeDirPath: {'$in' : ['posts']}
is the standard thing to do.
However, {relativeDirPath: {'$in' : ['posts', /post\/[0-9]+/ ]}
does not.
I am trying to get files that are in the following directory structure to be added to the posts
collection:
/src/documents/posts/blah-blah.html
/src/documents/post/12345678/foo-bar-baz.html
/src/documents/post/62347878/woop-woop.html
... and using pattern matching in relativeDirPath
seems to be the way to go.
However, it does not match any of those files.
How can I make this work?
Based on the requirement, you don't need pattern matching. The group query key "$or" should work for you: