2014-10-02 36 views
0

我使用的是eco rendererDocpad(構建基於https://github.com/zenorocha/browser-diet網站)無法使用的findAll()來搜索子目錄

在這裏面,我需要找到一個特定的子目錄中的所有文件。

目錄結構:

/src/documents/test1/test2

我需要找到存儲在test2

的文件我能找到的所有文件中test1使用:

<% for item in @getCollection("documents").findAll({ url: $startsWith: '/test1'}, [order:-1]).toJSON(): %> 

沒有文件當我添加一個額外的子目錄時被返回,使用:

<% for item in @getCollection("documents").findAll({ url: $startsWith: '/test1/test2'}, [order:-1]).toJSON(): %> 

該URL有文檔,所以我做錯了什麼?

回答

0

我認爲你是對的。我只是用下面的代碼測試它在我的項目(工具是我在docpad.coffee定義泛型集合):

<% for docu in @getCollection("tools").findAll(url:$startsWith:"/tools/adminui").toJSON(): %> 
    <% console.log(docu.url) %> 
<% end %> 

,並在控制檯中我得到的只有以/工具/ adminui開始的URL列表。 只是試着進一步調查它與控制檯輸出或共享更多細節