0
我把這個JSON從taffyDB.com(我把它縮短一點對於節省空間)taffyDB JSON樣本
var friends = TAFFY([
{"id":1,"gender":"M","first":"John"},
{"id":2,"gender":"F","first":"Kelly"},
{"id":3,"gender":"M","first":"Jeff"},
{"id":4,"gender":"F","first":"Jennifer"}
]);
我試圖用這個JSON與taffyDb
var friends = TAFFY([{
people:[
{ "id": 1, "gender": "M", "first": "John" },
{ "id": 2, "gender": "F", "first": "Kelly" },
{ "id": 3, "gender": "M", "first": "Jeff" },
{ "id": 4, "gender": "F", "first": "Jennifer" }
]
}]);
但我沒有任何運氣。
比方說,我想利用這個代碼:
// Find John Smith, by Gender and name
friends({gender: "M", first: "John"});
我無法得到它的工作。當我不包括人它的工作原理確定:[...]
我已經試過
friends({people.gender: "M", people.first: "John"});
但這並不工作。
任何想法?