In addition to being able to retrieve a path from a Falcor Model, you can also retrieve multiple Path Sets. Path Sets are paths that contain ranges or multiple string keys inside of indexers. In addition to being able to retrieve a Path Set, you can also retrieve as many paths as you like in a single method call.

You can fetch range of data:

model.get('people[0..1].titles[0].name')

Because what you fetch is not just a single a value, you need to use:

model.get()

Which return you a json string.

SO for example:

<!-- index.html -->
<html>
<head>
<!-- Do _not_ rely on this URL in production. Use only during development. -->
<script src="//netflix.github.io/falcor/build/falcor.browser.js"></script>
<script>
var model = new falcor.Model({
cache: {
people: [
{
name: "ZT",
titles: [
{
id: 123,
name: "Senior Frontend developer",
rating: 10
}
]
},
{
name: "WO",
titles: [
{
id: 321,
name: "Senior Software Engineer",
rating: 10
}
]
}
]
}
}); model.get('people[0..1].titles[0].name')
.then(function (json){
console.log(JSON.stringify(json, null, 2));
});
</script>
</head>
<body>
</body>
</html>

And what you will get:

{
"json": {
"people": {
"0": {
"titles": {
"0": {
"name": "Senior Frontend developer"
}
}
},
"1": {
"titles": {
"0": {
"name": "Senior Software Engineer"
}
}
}
}
}
}

You can pass multi enter points:

model.get('people[0..1].titles[0].name', 'people[0..1].titles[0].rating')

So you will get :

{
"json": {
"people": {
"0": {
"titles": {
"0": {
"name": "Senior Frontend developer",
"rating": 10
}
}
},
"1": {
"titles": {
"0": {
"name": "Senior Software Engineer",
"rating": 8
}
}
}
}
}
}

Notice that:

        model.get('people[0..1].titles[0].name',
'people[0..1].titles[0].rating')

The entor points we pass in are quite simialr, actually we can group them:

model.get('people[0..1].titles[0]["name", "rating"]')

You will still get the same result.

[Falcor] Retrieving Multiple Values的更多相关文章

  1. [Go] Returning Multiple Values from a Function in Go

    Returning multiple values from a function is a common idiom in Go, most often used for returning val ...

  2. python报错 TypeError: a() got multiple values for argument 'name'

    [问题现象] 在一次调用修饰函数中出现了问题,折腾了一下午,一直报错 TypeError:  got multiple values for argument 只是很简单的调用 from tsu2Ru ...

  3. Coroutines in Android - One Shot and Multiple Values

    Coroutines in Android - One Shot and Multiple Values 在Android中, 我们用到的数据有可能是一次性的, 也有可能是需要多个值的. 本文介绍An ...

  4. reverse/inverse a mapping but with multiple values for each key

    reverse/inverse a mapping but with multiple values for each key multi mappping dictionary , reverse/ ...

  5. 跨域:The 'Access-Control-Allow-Origin' header contains multiple values '*, *', but only one is allowed

    https://blog.csdn.net/q646926099/article/details/79082204 使用Ajax跨域请求资源,Nginx作为代理,出现:The 'Access-Cont ...

  6. 跨域The 'Access-Control-Allow-Origin' header contains multiple values '*, *', but only one is allowed.解决方案

    使用Ajax跨域请求资源,Nginx作为代理,出现:The 'Access-Control-Allow-Origin' header contains multiple values '*, *', ...

  7. 【问题解决】'Access-Control-Allow-Origin' header contains multiple values '*, *', but only one is allowed.

    问题复述 今天项目组有人找我说之前部署的程序在测试环境没问题,到生产环境出现了奇怪的问题,点按钮没反应. 我通过腾讯会议发现他们的浏览器控制台上打出了如下错误: Access to XMLHttpRe ...

  8. TypeError: test() got multiple values for keyword argument 'key'

    原因是: 1.函数调用的最终形式只会调用两个函数.一个list参数和一个dict参数,格式为call(func, list, dict); 2.如果传入参数中有key参数,那么首先key参数(包括扩展 ...

  9. Python TypeError: __init__() got multiple values for argument 'master'(转)

    转自:https://stackoverflow.com/questions/33153404/python-typeerror-init-got-multiple-values-for-argume ...

随机推荐

  1. Linux安装配置mongodb

    1. 下载MongoDB 2. 解压文件到某目录下,然后重命名: [root@localhost var]# tar -xzvf mongodb-linux-i686-2.0.1.tar [root@ ...

  2. WebService笔记-Schema约束

                        Schema约束 俗话说得好 好记性不如烂笔头. 看了下WebService视频,觉得还是得下笔记. 观看的视频地址:http://edu.51cto.com/ ...

  3. uvalive3026 Period (KMP+结论)

    题目链接:http://vjudge.net/problem/viewProblem.action?id=29342 题目大意:给定字符串,找到每个前缀的最大循环节的个数. 首先当然是kmp预处理,接 ...

  4. ECharts 是一款开源

    ECharts

  5. 超级易使用的jquery视频背景插件Vide

    http://www.jqcool.net/demo/201410/jquery-vide/ 官网: http://vodkabears.github.io/vide/

  6. springmvc参数类型转换三种方式

    SpringMVC绑定参数之类型转换有三种方式:     1. 实体类中加日期格式化注解      @DateTimeFormat(pattern="yyyy-MM-dd hh:MM&quo ...

  7. 等待事件--db file sequential read

    对于最小化db file sequential read 事件所带来的影响,你可以做的另一件事情是减少AVERAGE_WAIT时间. 这是会话必须等待从磁盘提取单块的平均时间,这些信息可以从v$ses ...

  8. 【HDOJ】3500 Fling

    题意巨难懂.简言之,就是球互相碰撞时,主动碰撞的球将会停止,另一个球将沿着碰撞方向继续移动,不断碰撞.但是无法弹射紧挨着的球,但是若a弹射b,bc相邻,这种情况b可以弹射c. #include < ...

  9. 【转】掌握java枚举类型(enum type)

    原文网址:http://iaiai.iteye.com/blog/1843553 1   背景 在java语言中还没有引入枚举类型之前,表示枚举类型的常用模式是声明一组具有int常量.之前我们通常利用 ...

  10. GCC使用

    GCC的选项 如何指定GCC的默认头 文件路径 Linux系统的头文件 和库文件搜索路径 头文件 库文件 运行时动态库的搜索路径 GCC的选项 -c 只生成目标文件(.o),不连接. % gcc -c ...