我从 taffyDB.com 获取了这个 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"});
但这也不起作用。
有任何想法吗?