http://dev.yathit.com/ydn-db/getting-started.htmlのドキュメントの例に従って、「並べ替え」の下の最初の例。
私のコード:
var schema = {
stores: [
{
name: "authors",
keyPath: "id",
indexes: [
{ keyPath: "born" }
]
}
]
};
var db = new ydn.db.Storage("library", schema);
db.put("authors", [{ id: "111", born: "zzz" }, { id: "555", born: "bbb" }, { id: "999", born: "aaa" }]).done(function() {
// query with default ordering
db.values("authors").done(function(r) {
console.log("A list of objects as expected", r);
});
// query by ordered by "born" field
db.values(new ydn.db.Cursors("authors", "born", null, false)).done(function(r) {
console.log("This is a list of ids, not objects", r);
});
});
クエリをデフォルトの順序付けから特定の列による順序付けに変更すると、その動作がオブジェクトのリストを返すことから単に ID のリストを返すように変わるようです。私は何か間違ったことをしていますか?オブジェクトのリストを取得するにはどうすればよいですか?