{"action":"created","comment":{"url":"https://api.github.com/repos/leancloud/docs/pulls/comments/63841273","id":63841273,"diff_hunk":"@@ -0,0 +1,2080 @@\n+{# 指定继承模板 #}\n+{% extends \"./leanstorage_guide.tmpl\" %}\n+\n+{# --Start--变量定义，主模板使用的单词和短语在所有子模板都必须赋值 #}\n+{% set cloudName =\"LeanCloud\" %}\n+{% set productName =\"LeanStorage\" %}\n+{% set platform_title =\"JavaScript\" %}\n+{% set segment_code =\"js\" %}\n+{% set sdk_name =\"JavaScript SDK\" %}\n+{% set baseObjectName =\"AV.Object\" %}\n+{% set objectIdName =\"id\" %}\n+{% set updatedAtName =\"updatedAt\" %}\n+{% set createdAtName =\"createdAt\" %}\n+{% set backgroundFunctionTemplate =\"xxxxInBackground\" %}\n+{% set saveEventuallyName =\"saveEventually\" %}\n+{% set deleteEventuallyName =\"deleteEventually\" %}\n+{% set relationObjectName =\"AV.Relation\" %}\n+{% set pointerObjectName =\"AV.Pointer\" %}\n+{% set baseQueryClassName =\"AV.Query\" %}\n+{% set geoPointObjectName =\"AV.GeoPoint\" %}\n+{% set userObjectName =\"AV.User\" %}\n+{% set fileObjectName =\"AV.File\" %}\n+{% set dateType= \"Date\" %}\n+{% set byteType= \"Buffer\" %}\n+{% set link_to_acl_doc =\"[JavaScript 权限管理使用指南](acl_guide-js.html)\" %}\n+{% set funtionName_whereKeyHasPrefix = \"whereKey:hasPrefix:\" %}\n+\n+{% block text_for_ts_developer %}\n+## TypeScript 开发者\n+伴随着 [Angular2](https://angular.io/) 以及  [ionic@2](http://ionicframework.com/docs/v2/) 的受欢迎，LeanCloud 也针对 JavaScript SDK 编写了一个 `d.ts` 定义文件提供给开发者使用。\n+\n+本质上，TypeScript 经过编译之后实际上也是调用 JavaScript SDK 的对应的接口，因此在本文代码块中，一些 TypeScript 写法可以给开发者进行参考。\n+\n+注意，TypeScript 针对异步函数有多种写法，本文采用 [Promise](#Promise) 的作为默认的示例代码书写方式，仅供参考。\n+ [Promise](#Promise) 以及 Typescript 中的 [async/await](https://blogs.msdn.microsoft.com/typescript/2015/11/03/what-about-asyncawait/) 的不同写法的支持取决于在 TypeScript 项目中的 `tsconfig.json` 的 `compilerOptions` 配置里面选择 `target` 是什么版本，例如，要支持 [async/await](https://blogs.msdn.microsoft.com/typescript/2015/11/03/what-about-asyncawait/) 需要进入如下配置：\n+\n+```json\n+{\n+  ...\n+  \"compilerOptions\": {\n+    ...\n+    \"target\": \"es6\",\n+    \"module\": \"commonjs\",\n+    ...\n+  },\n+  ...\n+}\n+```\n+关于在 ES6 编译模式下的如何使用 TypeScript 中的 [async/await](https://blogs.msdn.microsoft.com/typescript/2015/11/03/what-about-asyncawait/) 请参考这片[文章](/*todo*/)：\n+\n+注意：因为 TypeScript SDK 是基于 JavaScript SDK 编写的定义文件，因此并不是所有 JavaScript SDK 的接口都有对应 TypeScript 的版本，示例代码会持续更新。\n+\n+### TypeScript SDK 安装\n+#### 通过 typings 工具安装\n+\n+> Todo\n+\n+#### 直接引用 d.ts 文件\n+\n+> Todo\n+\n+{% endblock %}\n+\n+{# --End--变量定义，主模板使用的单词和短语在所有子模板都必须赋值 #}\n+\n+{# --Start--主模板留空的代码段落，子模板根据自身实际功能给予实现 #}\n+\n+{% block code_quick_save_a_todo %}\n+\n+```js\n+  var Todo = AV.Object.extend('Todo');// 声明一个 Todo 类型\n+  var todo = new Todo();  // 新建一个 Todo 对象\n+  todo.set('title', '工程师周会');\n+  todo.set('content', '每周工程师会议，周一下午2点');\n+  todo.save().then(function (todo) {\n+    // 成功保存之后，执行其他逻辑.\n+    console.log('New object created with objectId: ' + todo.id);\n+  }, function (err) {\n+    // 失败之后执行其他逻辑\n+    // error 是 AV.Error 的实例，包含有错误码和描述信息.\n+    console.log('Failed to create new object, with error message: ' + err.message);\n+  });\n+```\n+```ts\n+  let todo = new AV.Object('Todo');\n+  todo.set('title', '工程师周会');\n+  todo.set('content', '每周工程师会议，周一下午2点');\n+  todo.save<AV.Object>().then(\n+      (data) => {\n+        // data 是根据 todo.save<AV.Object> 传入的泛型参数决定\n+        let savedTodo : AV.Object = data;\n+      },\n+      (error) => {\n+        if(error) throw error;\n+      }\n+  );\n+```\n+\n+{% endblock %}\n+\n+{% block code_quick_save_a_todo_with_location %}\n+\n+```js\n+  var Todo = AV.Object.extend('Todo');\n+  var todo = new Todo();\n+  todo.set('title', '工程师周会');\n+  todo.set('content', '每周工程师会议，周一下午2点');\n+  todo.set('location','会议室');// 只要添加这一行代码，服务端就会自动添加这个字段\n+  todo.save().then(function (todo) {\n+    // 成功保存之后，执行其他逻辑.\n+  }, function (err) {\n+    // 失败之后执行其他逻辑\n+    // error 是 AV.Error 的实例，包含有错误码和描述信息.\n+  });\n+```\n+```ts\n+  let todo = new AV.Object('Todo');\n+  todo.set('title', '工程师周会');\n+  todo.set('content', '每周工程师会议，周一下午2点');\n+  todo.set('location', '会议室');//只要添加这一行代码，服务端就会自动添加这个字段\n+  todo.save<AV.Object>().then(\n+      (data) => {\n+        // data 是根据 todo.save<AV.Object> 传入的泛型参数决定\n+        let savedTodo : AV.Object = data;\n+        console.log(savedTodo.get('location'));\n+      },\n+      (error) => {\n+        if(error) throw error;\n+      }\n+  );\n+```\n+{% endblock %}\n+\n+{% block code_create_todo_object %}\n+\n+```js\n+  // AV.Object.extend('className') 所需的参数 className 则表示对应的表名\n+  var Todo = AV.Object.extend('Todo');// 声明一个类型\n+```\n+```ts\n+  // AV.Object.extend('className') 所需的参数 className 则表示对应的表名\n+  var Todo = AV.Object.extend('Todo');\n+\n+  // 在 TypeScript 当中我们推荐如下创建对象的方式\n+  let todo = new AV.Object('Todo');\n+```\n+\n+**注意**：`AV.Object.extend` 产生的对象需要作为全局变量保存，因为每调用\n+一次，就会产生一个新的类的实例，并且和之前创建的实例形成一个链表。\n+如果你的应用时不时出现 `Maximum call stack size exceeded` 错误，请\n+确认是否误用了该方法。\n+{% endblock %}\n+\n+{% block code_save_object_by_cql %}\n+\n+```js\n+  // 执行 CQL 语句实现新增一个 TodoFolder 对象\n+  AV.Query.doCloudQuery('insert into TodoFolder(name, priority) values(\"工作\", 1)').then(function (data) {\n+    // data 中的 results 是本次查询返回的结果，AV.Object 实例列表\n+    var results = data.results;\n+  }, function (error) {\n+    //查询失败，查看 error\n+    console.log(error);\n+  });\n+```\n+```ts\n+  // 执行 CQL 语句实现新增一个 TodoFolder 对象\n+  AV.Query.doCloudQuery<any>('insert into TodoFolder(name, priority) values(\"工作\", 1)').then(\n+    (data) => {\n+      // 传入泛型参数提高代码阅读性以及后续的智能提示\n+      let savedTodo : AV.Object = data.results[0];\n+    },\n+    (error) => {\n+    if(error) throw error;\n+    }\n+  );\n+```\n+{% endblock %}\n+\n+{% block code_data_type %}\n+```js\n+// 该语句应该只声明一次\n+var TestObject = AV.Object.extend('DataTypeTest');\n+\n+var number = 2014;\n+var string = 'famous film name is ' + number;\n+var date = new Date();\n+var array = [string, number];\n+var object = { number: number, string: string };\n+\n+var testObject = new TestObject();\n+testObject.set('testNumber', number);\n+testObject.set('testString', string);\n+testObject.set('testDate', date);\n+testObject.set('testArray', array);\n+testObject.set('testObject', object);\n+testObject.set('testNull', null);\n+testObject.save().then(function(testObject) {\n+  // 成功\n+}, function(error) {\n+  // 失败\n+});\n+```\n+```ts\n+  let testNumber : number = 13;\n+  let testString : string = 'here is a test string';\n+  let testDate : Date = new Date('2016-06-04');\n+  let testNumberArray : Array<number> = [1, 2, 3];\n+  let testStringArray : Array<string> = ['here','is','a','string','array'];\n+  let testObjectType : Object = {name:'LeanCloud',url:'https://leancloud.cn'};\n+\n+  let testAVObject = new AV.Object('TestClass');\n+  testAVObject.set('testNumber', testNumber);\n+  testAVObject.set('testString', testString);\n+  testAVObject.set('testDate', testDate);\n+  testAVObject.set('testNumberArray', testNumberArray);\n+  testAVObject.set('testStringArray', testStringArray);\n+  testAVObject.set('testObject', testObjectType);\n+\n+  testAVObject.save<AV.Object>().then(\n+    (data) => {\n+  },(error) =>{\n+    if(error) throw error;\n+  });\n+```\n+\n+我们**不推荐**在 `AV.Object` 中储存大块的二进制数据，比如图片或整个文件。**每个 `AV.Object` 的大小都不应超过 128 KB**。如果需要储存更多的数据，建议使用 [`AV.File`](#文件)。\n+\n+若想了解更多有关 LeanStorage 如何解析处理数据的信息，请查看专题文档《[数据与安全](./data_security.html)》。\n+{% endblock %}\n+\n+{% block code_save_todo_folder %}\n+\n+```js\n+   var TodoFolder = AV.Object.extend('TodoFolder');// 声明类型\n+   var todoFolder = new TodoFolder();// 新建对象\n+   todoFolder.set('name','工作');// 设置名称\n+   todoFolder.set('priority',1);// 设置优先级\n+   todoFolder.save().then(function (todo) {\n+      console.log('objectId is ' + todo.id);\n+    }, function (err) {\n+      console.log(err);\n+   });// 保存到云端\n+```\n+```ts\n+  let todoFolder:AV.Object = new AV.Object('TodoFolder');// 新建对象\n+  todoFolder.set('name','工作');// 设置名称\n+  todoFolder.set('priority',1);// 设置优先级\n+  todoFolder.save<AV.Object>().then(\n+    (data) => {\n+      let savedTodoFolder : AV.Object = data;\n+  },(error)=>{\n+    if(error) throw error;\n+  });\n+```\n+{% endblock %}\n+\n+{% block code_saveoption_query_example %}\n+\n+```js\n+    new AV.Query('Wiki').first().then(function (data) {\n+        var wiki = data;\n+        var currentVersion = wiki.get('version');\n+        wiki.set('version', currentVersion + 1);\n+        wiki.save(null, {\n+            query: new AV.Query('Wiki').equalTo('version', currentVersion)\n+        }).then(function (data) {\n+        }, function (error) {\n+            if (error)\n+                throw error;\n+        });\n+    }, function (error) {\n+        if (error)\n+            throw error;\n+    });\n+```\n+```ts\n+  new AV.Query('Wiki').first<AV.Object>().then((data) => {\n+    let wiki:AV.Object = data;\n+    let currentVersion = wiki.get('version');\n+    wiki.set('version',currentVersion + 1);\n+    wiki.save<AV.Object>(null,{\n+      query:new AV.Query('Wiki').equalTo('version', currentVersion)\n+    }).then((data) =>{\n+    // data 是一个 AV.Object 并且是版本更新之后的 Wiki 对象\n+    },error=>{\n+      if(error) throw error;\n+    });\n+  },error=>{\n+    if(error) throw error;\n+  })\n+```\n+{% endblock %}\n+\n+{% block code_get_todo_by_objectId %}\n+\n+```js\n+  var query = new AV.Query('Todo');\n+  query.get('57328ca079bc44005c2472d0').then(function (data) {\n+    // 成功获得实例\n+    // data 就是 id 为 57328ca079bc44005c2472d0 的 Todo 对象实例\n+  }, function (error) {\n+    // 失败了\n+  });\n+```\n+```ts\n+  var query = new AV.Query('Todo');\n+  query.get<AV.Object>('57328ca079bc44005c2472d0').then((data)=>{\n+    // 成功获得实例\n+    // data 就是 id 为 57328ca079bc44005c2472d0 的 Todo 对象实例\n+  },(error)=>{\n+    if(error) throw error;\n+  });\n+```\n+{% endblock %}\n+\n+{% block code_save_callback_get_objectId %}\n+\n+```js\n+  var todo = new Todo();\n+  todo.set('title', '工程师周会');\n+  todo.set('content', '每周工程师会议，周一下午2点');\n+  todo.save().then(function (todo) {\n+    // 成功保存之后，执行其他逻辑\n+    var objectId = todo.id;// 获取 objectId\n+  }, function (err) {\n+    // 失败之后执行其他逻辑\n+    // error 是 AV.Error 的实例，包含有错误码和描述信息.\n+  });\n+```\n+```ts\n+  let todo : AV.Object = new AV.Object('Todo');\n+  todo.set('title', '工程师周会');\n+  todo.set('content', '每周工程师会议，周一下午2点');\n+  todo.save<AV.Object>().then((data) => {\n+    // 成功保存之后，执行其他逻辑\n+    let objectId = data.id;// 获取 objectId\n+  },  (error)=> {\n+    // 失败之后执行其他逻辑\n+    // error 是 AV.Error 的实例，包含有错误码和描述信息.\n+  });\n+```\n+{% endblock %}\n+\n+{% block code_access_todo_folder_properties %}\n+\n+```js\n+  var query = new AV.Query('Todo');\n+  query.get('558e20cbe4b060308e3eb36c').then(function (todo) {\n+    // 成功获得实例\n+    // todo 就是 id 为 558e20cbe4b060308e3eb36c 的 Todo 对象实例\n+    var priority = todo.get('priority');\n+    var location = todo.get('location');\n+    var title = todo.get('title');\n+    var content = todo.get('content');\n+\n+    // 获取三个特殊属性\n+    var objectId = todo.id;\n+    var updatedAt = todo.updatedAt;\n+    var createdAt = todo.createdAt;\n+    console.log(createdAt);//Wed May 11 2016 09:36:32 GMT+0800 (CST)\n+  }, function (error) {\n+    // 失败了\n+  });\n+```\n+```ts\n+  let query : AV.Query = new AV.Query('Todo');\n+  query.get<AV.Object>('57328ca079bc44005c2472d0').then((todo)=>{\n+    let priority : number = todo.get('priority');\n+    let location : string = todo.get('location');// 可以指定读取的类型\n+    let title = todo.get('title');// 也可以不指定读取的类型\n+\n+    // 获取三个特殊属性\n+    let objectId : string = todo.id;\n+    var updatedAt : Date = todo.updatedAt;\n+    var createdAt : Date = todo.createdAt;\n+    console.log(createdAt);//Wed May 11 2016 09:36:32 GMT+0800 (CST)\n+  },(error)=>{\n+    if(error) throw error;\n+  });\n+```\n+{% endblock %}\n+\n+{% block code_object_fetch %}\n+\n+```js\n+  // 使用已知 objectId 构建一个 AV.Object\n+  var todo = new Todo();\n+  todo.id = '5590cdfde4b00f7adb5860c8';\n+  todo.fetch().then(function (todo) {\n+    // // todo 是从服务器加载到本地的 Todo 对象\n+    var priority = todo.get('priority');\n+  }, function (error) {\n+\n+  });\n+```\n+```ts\n+  let todo : AV.Object = new AV.Object('Todo');\n+  todo.id = '57328ca079bc44005c2472d0';\n+  todo.fetch<AV.Object>().then((todo)=>{\n+    // todo 是从服务器加载到本地的 AV.Object\n+    let priority : number = todo.get('priority');// 读取 todo 的属性\n+  },(error)=>{\n+    if(error) throw error;\n+  });\n+```\n+{% endblock %}\n+\n+{% block code_object_fetchWhenSave %}\n+\n+```js\n+  todo.fetchWhenSave(true);//设置 fetchWhenSave 为 true\n+  todo.save().then(function () {\n+    // 保存成功\n+  }, function (error) {\n+    // 失败\n+  });\n+```\n+```ts\n+  let todo : AV.Object = new AV.Object('Todo');\n+  todo.fetchWhenSave(true);\n+  todo.save<AV.Object>().then((data)=>{\n+    // 保存成功\n+  },(error)=>{\n+    if(error) throw error;\n+  });\n+```\n+{% endblock %}\n+\n+{% block code_object_fetch_with_keys %}\n+\n+```js\n+  // 使用已知 objectId 构建一个 AV.Object\n+  var todo = new Todo();\n+  todo.id = '5590cdfde4b00f7adb5860c8';\n+  todo.fetch({include:'priority,location'},{}).then(function (todo) {\n+    // 获取到本地\n+  }, function (error) {\n+\n+  });\n+```\n+```ts\n+  // 使用已知 objectId 构建一个 AV.Object\n+  let todo:AV.Object = AV.Object.createWithoutData('Todo', '57328ca079bc44005c2472d0');\n+  //  传入 include 参数，指定获取的属性\n+  todo.fetch<AV.Object>(\n+    {include:'priority,location'\n+  },{}).then(\n+    (todo) =>{\n+    // 获取到本地\n+  }, (error) =>{\n+    if(error) throw error;\n+  });\n+```\n+{% endblock %}\n+\n+{% block code_update_todo_location %}\n+\n+```js\n+  // 已知 objectId，创建 AVObject\n+  // 第一个参数是 className，第二个参数是该对象的 objectId\n+  var todo = AV.Object.createWithoutData('Todo', '558e20cbe4b060308e3eb36c');\n+  // 更改属性\n+  todo.set('location', '二楼大会议室');\n+  // 保存\n+  todo.save().then(function () {\n+    // 保存成功\n+  }, function (error) {\n+    // 失败\n+  });\n+```\n+```ts\n+  // 已知 objectId，创建 AV.Object\n+  // 第一个参数是 className，第二个参数是该对象的 objectId\n+  let todo:AV.Object = AV.Object.createWithoutData('Todo', '558e20cbe4b060308e3eb36c');\n+  // 更改属性\n+  todo.set('location', '二楼大会议室');\n+  todo.save<AV.Object>().then((todo)=>{\n+    // 保存成功，可以打开控制台核对修改结果\n+    done();\n+  },(error)=>{\n+    if(error) throw error;\n+  });\n+```\n+{% endblock %}\n+\n+{% block code_update_object_by_cql %}\n+\n+```js\n+  // 执行 CQL 语句实现更新一个 TodoFolder 对象\n+  AV.Query.doCloudQuery('update TodoFolder set name=\"家庭\" where objectId=\"558e20cbe4b060308e3eb36c\"').then(function (data) {\n+    // data 中的 results 是本次查询返回的结果，AV.Object 实例列表\n+    var results = data.results;\n+  }, function (error) {\n+    //查询失败，查看 error\n+    console.log(error);\n+  });\n+```\n+```ts\n+  // 执行 CQL 语句实现更新一个 TodoFolder 对象\n+  AV.Query.doCloudQuery<any>('update TodoFolder set name=\"家庭\" where objectId=\"558e20cbe4b060308e3eb36c\"').then(\n+    (data) => {\n+      let savedTodo : AV.Object = data.results[0];\n+    },\n+    (error) => {\n+      if(error) throw error;\n+    }\n+  );\n+```\n+{% endblock %}\n+\n+{% block code_atomic_operation_increment %}\n+\n+```js\n+  var todo = AV.Object.createWithoutData('Todo', '57328ca079bc44005c2472d0');\n+  todo.set('views', 0);\n+  todo.save().then(function (todo) {\n+      todo.increment(\"views\", 1);\n+      todo.fetchWhenSave(true);\n+      // 也可以指定增加一个特定的值\n+      // 例如一次性加 5\n+      todo.increment(\"views\", 5);\n+      todo.save().then(function (data) {\n+        // 因为使用了 fetchWhenSave 选项，save 调用之后，如果成功的话，对象的计数器字段是当前系统最新值。\n+      }, function (error) {\n+          if (error)\n+              throw error;\n+      });\n+  }, function (error) {\n+      if (error)\n+          throw error;\n+  });\n+```\n+```ts\n+  let todo:AV.Object = AV.Object.createWithoutData('Todo', '57328ca079bc44005c2472d0');\n+  todo.set('views',0);\n+  todo.save<AV.Object>().then((todo)=>{\n+    todo.increment(\"views\",1);\n+    todo.fetchWhenSave(true);\n+    // 也可以指定增加一个特定的值\n+    // 例如一次性加 5\n+    todo.increment(\"views\",5);\n+    todo.save<AV.Object>().then((data)=>{\n+      // 因为使用了 fetchWhenSave 选项，save 调用之后，如果成功的话，对象的计数器字段是当前系统最新值。\n+    },(error)=>{\n+      if(error) throw error;\n+    });\n+  },(error)=>{\n+    if(error) throw error;\n+  });\n+```\n+{% endblock %}\n+\n+{% block code_atomic_operation_array %}\n+\n+* `AV.Object.add('arrayKey',arrayValue)`<br>\n+  将指定对象附加到数组末尾。\n+* `AV.Object.addUnique('arrayKey',arrayValue);`<br>\n+  如果不确定某个对象是否已包含在数组字段中，可以使用此操作来添加。对象的插入位置是随机的。  \n+* `AV.Object.remove('arrayKey',arrayValue);`<br>\n+  从数组字段中删除指定对象的所有实例。\n+\n+{% endblock %}\n+\n+{% block code_set_array_value %}\n+\n+```js\n+  var reminder1 = new Date('2015-11-11 07:10:00');\n+  var reminder2 = new Date('2015-11-11 07:20:00');\n+  var reminder3 = new Date('2015-11-11 07:30:00');\n+\n+  var reminders = [reminder1, reminder2, reminder3];\n+\n+  var todo = new AV.Object('Todo');\n+  // 指定 reminders 是做一个 Date 对象数组\n+  todo.addUnique('reminders', reminders);\n+  todo.save().then(function (todo) {\n+   console.log(todo.id);\n+  }, function (error) {\n+  });\n+```\n+```ts\n+  let reminder1: Date = new Date('2015-11-11 07:10:00');\n+  let reminder2: Date = new Date('2015-11-11 07:20:00');\n+  let reminder3: Date = new Date('2015-11-11 07:30:00');\n+\n+  let reminders : Array<Date> = [reminder1,reminder2,reminder3];\n+\n+  let todo : AV.Object = new AV.Object('Todo');\n+  todo.addUnique('reminders',reminders);\n+  todo.save<AV.Object>().then((todo)=>{\n+  },(error)=>{\n+  })\n+```\n+{% endblock %}\n+\n+{% block code_delete_todo_by_objectId %}\n+\n+```js\n+    var todo = AV.Object.createWithoutData('Todo', '57328ca079bc44005c2472d0');\n+    todo.destroy().then(function (success) \u0010\u0010\u0010{\n+    // 删除成功\n+    }, function (error) {\n+    // 删除失败\n+    });\n+```\n+```ts\n+  let todo:AV.Object = AV.Object.createWithoutData('Todo', '57328ca079bc44005c2472d0');\n+  todo.destroy().then(\n+    (success)=>{\n+    // 删除成功\n+  },(error)=>{\n+    // 删除失败\n+  });\n+```\n+{% endblock %}\n+\n+{% block code_delete_todo_by_cql %}\n+\n+```js\n+  // 执行 CQL 语句实现删除一个 Todo 对象\n+  AV.Query.doCloudQuery('delete from Todo where objectId=\"558e20cbe4b060308e3eb36c\"').then(function (data) {\n+  }, function (error) {\n+  });\n+```\n+```ts\n+  // 执行 CQL 语句实现删除一个 Todo 对象\n+  AV.Query.doCloudQuery<AV.Object>('delete from Todo where objectId=\"558e20cbe4b060308e3eb36c\"').then(\n+    (data) => {\n+    },\n+    (error) => {\n+    }\n+  );\n+```\n+{% endblock %}\n+\n+{% block code_batch_operation %}\n+\n+```js\n+  var avObjectArray = [];// 构建一个本地的 AV.Object 对象数组\n+\n+   // 批量创建、更新\n+  AV.Object.saveAll(avObjectArray).then(function (avobjs) {\n+  }, function (error) {\n+  });\n+  // 批量删除\n+  AV.Object.destroyAll(avObjectArray).then(function (avobjs) {\n+  }, function (error) {\n+  });\n+  // 批量获取\n+  AV.Object.fetchAll(avObjectArray).then(function (avobjs) {\n+  }, function (error) {\n+  });                    \n+```\n+```ts\n+  let avObjectArray:Array<AV.Object> = [/*...*/];// 构建一个 AV.object 数组\n+\n+  // 批量创建、更新\n+  AV.Object.saveAll<AV.Object []>(avObjectArray).then((avobjs)=>{\n+  },(error)=>{\n+  });\n+\n+  // 批量删除\n+  AV.Object.destroyAll<AV.Object []>(avObjectArray).then((avobjs)=>{\n+  },(error)=>{\n+  });\n+\n+  // 批量获取\n+  AV.Object.fetchAll<AV.Object []>(avObjectArray).then((avobjs)=>{\n+  },(error)=>{\n+  });\n+```\n+{% endblock %}\n+\n+{% block code_batch_set_todo_completed %}\n+\n+```js\n+  var query = new AV.Query('Todo');\n+  query.find().then(function (todos) {\n+      for (var i = 0; i < todos.length; i++) {\n+          var todo = todos[i];\n+          todo['status'] = 1;\n+      }\n+      AV.Object.saveAll(todos).then(function (success) {\n+      }, function (error) {\n+      });\n+  }, function (error) {\n+  });\n+```\n+```ts\r\n+  let query:AV.Query = new AV.Query('Todo');\n+  query.find<AV.Object []>().then((todos)=>{\n+    for(let todo of todos){\n+      todo['status'] = 1;\n+    }\n+\n+    AV.Object.saveAll(todos).then(\n+      (success)=>{\n+        // 保存成功\n+    },(error)=>{\n+    })\n+  },(error)=>{\n+  });\n+```\n+{% endblock %}\n+\n+{% block text_work_in_background %}{% endblock %}\n+{% block save_eventually %}{% endblock %}\n+\n+{% block code_relation_todoFolder_one_to_many_todo %}\n+\n+```js\n+  var todoFolder = new AV.Object('TodoFolder');\n+  todoFolder.set('name', '工作');\n+  todoFolder.set('priority', 1);\n+\n+  var todo1 = new AV.Object('Todo');\n+  todo1.set('title', '工程师周会');\n+  todo1.set('content', '每周工程师会议，周一下午2点');\n+  todo1.set('location', '会议室');\n+\n+  var todo2 = new AV.Object('Todo');\n+  todo2.set('title', '维护文档');\n+  todo2.set('content', '每天 16：00 到 18：00 定期维护文档');\n+  todo2.set('location', '当前工位');\n+\n+  var todo3 = new AV.Object('Todo');\n+  todo3.set('title', '发布 SDK');\n+  todo3.set('content', '每周一下午 15：00');\n+  todo3.set('location', 'SA 工位');\n+\n+  var localTodos = [todo1, todo2, todo3];\n+  AV.Object.saveAll(localTodos).then(function (cloudTodos) {\n+      var relation = todoFolder.relation('containedTodos'); // 创建 AV.Relation\n+      for (var i = 0; i < cloudTodos.length; i++) {\n+          var todo = cloudTodos[i];\n+          relation.add(todo);// 建立针对每一个 Todo 的 Relation\n+      }\n+      todoFolder.save();// 保存到云端\n+  }, function (error) {\n+  });\n+```\n+```ts\n+  let todoFolder : AV.Object = new AV.Object('TodoFolder');\n+  todoFolder.set('name','工作');\n+  todoFolder.set('priority',1);\n+\n+  let todo1 : AV.Object = new AV.Object('Todo');\n+  todo1.set('title','工程师周会');\n+  todo1.set('content','每周工程师会议，周一下午2点');\n+  todo1.set('location','会议室');\n+\n+  let todo2 : AV.Object = new AV.Object('Todo');\n+  todo2.set('title','维护文档');\n+  todo2.set('content','每天 16：00 到 18：00 定期维护文档');\n+  todo2.set('location','当前工位');\n+\n+  let todo3 : AV.Object = new AV.Object('Todo');\n+  todo3.set('title','发布 SDK');\n+  todo3.set('content','每周一下午 15：00');\n+  todo3.set('location','SA 工位');\n+\n+  let localTodos:Array<AV.Object> = [todo1,todo2,todo3];// 构建一个 AV.object 数组\n+  AV.Object.saveAll<AV.Object []>(localTodos).then(\n+    (cloudTodos)=>{\n+      let relation: AV.Relation = todoFolder.relation('containedTodos');// 创建 AV.Relation\n+      for(let todo of cloudTodos){\n+        relation.add(todo);// 建立针对每一个 Todo 的 Relation\n+      }\n+      todoFolder.save();// 保存到云端\n+    },(error)=>{\n+\n+    });\n+```\n+{% endblock %}\n+\n+{% block code_pointer_comment_one_to_many_todoFolder %}\n+\n+```js\n+  var comment = new AV.Object('Comment');// 构建 Comment 对象\n+  comment.set('like', 1);// 如果点了赞就是 1，而点了不喜欢则为 -1，没有做任何操作就是默认的 0\n+  comment.set('content', '这个太赞了！楼主，我也要这些游戏，咱们团购么？');\n+  // 假设已知被分享的该 TodoFolder 的 objectId 是 5735aae7c4c9710060fbe8b0\n+  var targetTodoFolder = AV.Object.createWithoutData('TodoFolder', '5735aae7c4c9710060fbe8b0');\n+  comment.set('targetTodoFolder', targetTodoFolder);\n+  comment.save();//保存到云端\n+```\n+```ts\n+  let comment : AV.Object = new AV.Object('Comment');// 构建 Comment 对象\n+  comment.set('like',1);// 如果点了赞就是 1，而点了不喜欢则为 -1，没有做任何操作就是默认的 0\n+  comment.set('content','这个太赞了！楼主，我也要这些游戏，咱们团购么？');\n+\n+  // 假设已知被分享的该 TodoFolder 的 objectId 是 5735aae7c4c9710060fbe8b0\n+  let targetTodoFolder : AV.Object = AV.Object.createWithoutData('TodoFolder','5735aae7c4c9710060fbe8b0');\n+  comment.set('targetTodoFolder',targetTodoFolder);\n+  comment.save();//保存到云端\n+```\n+{% endblock %}\n+\n+{% block code_create_geoPoint %}\n+``` js\n+  // 第一个参数是： latitude ，纬度\n+  // 第二个参数是： longitude，经度\n+  var point1 = new AV.GeoPoint(39.9, 116.4);\n+\n+  // 以下是创建 AV.GeoPoint 对象不同的方法\n+  var point2 = new AV.GeoPoint([12.7, 72.2]);\n+  var point3 = new AV.GeoPoint({ latitude: 30, longitude: 30 });\n+```\n+```ts\n+  // 第一个参数是： latitude ，纬度\n+  // 第二个参数是： longitude，经度\n+  let point1 : AV.GeoPoint = new AV.GeoPoint(39.9,116.4);\n+\n+  // 以下是创建 AV.GeoPoint 对象不同的方法\n+  let point2 : AV.GeoPoint = new AV.GeoPoint([12.7,72.2]);\n+  let point3 : AV.GeoPoint = new AV.GeoPoint({latitude: 30, longitude: 30});\n+```\n+{% endblock %}\n+\n+{% block code_use_geoPoint %}\n+``` objc\n+[todo setObject:point forKey:@\"whereCreated\"];\n+```\n+{% endblock %}\n+\n+{% block text_deserialize_and_serialize %}\n+<!--- js 以及 ts 没有序列化和反序列化的需求--->\n+{% endblock %}\n+\n+{% block code_data_protocol_save_date %}\n+```js\n+  var testDate = new Date('2016-06-04');\n+  var testAVObject = new AV.Object('TestClass');\n+  testAVObject.set('testDate', testDate);\n+  testAVObject.save();\n+```\n+```ts\n+  let testDate : Date = new Date('2016-06-04');\n+  let testAVObject = new AV.Object('TestClass');\n+  testAVObject.set('testDate', testDate);\n+  testAVObject.save();\n+```\n+{% endblock %}\n+\n+{% block code_create_avfile_by_stream_data %}\n+\n+```js\n+  var data = { base64: '6K+077yM5L2g5Li65LuA5LmI6KaB56C06Kej5oiR77yf' };\n+  var file = new AV.File('resume.txt', data);\n+  file.save().then(function (savedFile) {\n+  }, function (error) {\n+  });\n+\n+  var bytes = [0xBE, 0xEF, 0xCA, 0xFE];\n+  var byteArrayFile = new AV.File('myfile.txt', bytes);\n+  byteArrayFile.save();\n+```\n+```ts\n+  let data = { base64:'6K+077yM5L2g5Li65LuA5LmI6KaB56C06Kej5oiR77yf'};\n+  let file : AV.File = new AV.File('resume.txt',data);\n+  file.save<AV.File>().then((savedFile)=>{\n+  },(error)=>{\n+  });\n+\n+  let bytes = [ 0xBE, 0xEF, 0xCA, 0xFE ];\n+  let byteArrayFile:AV.File = new AV.File('myfile.txt',bytes);\n+  byteArrayFile.save();\n+```\n+{% endblock %}\n+\n+{% block code_create_avfile_from_local_path %}\n+假设在页面上有如下文件选择框：\n+\n+```html\n+<input type=\"file\" id=\"photoFileUpload\"/>\n+```\n+上传文件对应的代码如下：\n+```js\n+    var fileUploadControl = $('#photoFileUpload')[0];\n+    if (fileUploadControl.files.length > 0) {\n+      var file = fileUploadControl.files[0];\n+      var name = 'avatar.jpg';\n+\n+      var avFile = new AV.File(name, file);\n+      avFile.save().then(function(obj) {\n+        // 数据保存成功\n+        console.log(obj.url());\n+      }, function(err) {\n+        // 数据保存失败\n+        console.log(err);\n+      });\n+    }\n+```\n+{% endblock %}\n+\n+{% block code_create_avfile_from_url %}\n+\n+```js\n+  var file = AV.File.withURL('Satomi_Ishihara.gif', 'http://ww3.sinaimg.cn/bmiddle/596b0666gw1ed70eavm5tg20bq06m7wi.gif');\n+  file.save().then(function (savedFile) {\n+  }, function (error) {\n+  });\n+```\n+```ts\n+  let file : AV.File = AV.File.withURL('Satomi_Ishihara.gif','http://ww3.sinaimg.cn/bmiddle/596b0666gw1ed70eavm5tg20bq06m7wi.gif');\n+  file.save<AV.File>().then((savedFile)=>{\n+  },(error)=>{\n+  });\n+```\n+{% endblock %}\n+\n+{% block code_upload_file %}\n+如果仅是想简单的上传，可以直接在 Web 前端使用 AV.File 上面的相关方法。但真实使用场景中，还有很多开发者需要自行实现一个上传接口，对数据做更多的处理。\n+\n+以下是一个在 Web 中完整上传一张图片的 Demo，包括前端与 Node.js 服务端代码。服务端推荐使用 LeanCloud 推出的「[云引擎](leanengine_overview.html)」，非常出色的 Node.js 环境。\n+\n+前端页面（比如:fileUpload.html）：\n+```html\n+// 页面元素（限制上传为图片类型，使用时可自行修改 accept 属性）\n+<form id=\"upload-file-form\" class=\"upload\" enctype=\"multipart/form-data\">\n+  <input name=\"attachment\" type=\"file\" accept=\"image/gif, image/jpeg, image/png\">\n+</form>\n+```\n+纯前端调用方式：\n+\n+```javascript\n+// 前端代码，基于 jQuery\n+function uploadPhoto() {\n+  var uploadFormDom = $('#upload-file-form');\n+  var uploadInputDom = uploadFormDom.find('input[type=file]');\n+  // 获取浏览器 file 对象\n+  var files = uploadInputDom[0].files;\n+  // 创建 formData 对象\n+  var formData = new window.FormData(uploadFormDom[0]);\n+  if (files.length) {\n+    $.ajax({\n+      // 注意，这个 url 地址是一个例子，真实使用时需替换为自己的上传接口 url\n+      url: 'https://leancloud.cn/xxx/xxx/upload',\n+      method: 'post',\n+      data: formData,\n+      processData: false,\n+      contentType: false\n+    }).then((data) => {\n+      // 上传成功，服务端设置返回\n+      console.log(data);\n+    });\n+  }\n+};\n+```\n+\n+在服务端可以编写如下代码：\n+\n+```javascript\n+// 服务端代码，基于 Node.js、Express\n+var AV = require('leanengine');\n+// 服务端需要使用 connect-busboy（通过 npm install 安装）\n+var busboy = require('connect-busboy');\n+// 使用这个中间件\n+app.use(busboy());\n+\n+// 上传接口方法（使用时自行配置到 router 中）\n+function uploadFile (req, res) {\n+  if (req.busboy) {\n+    var base64data = [];\n+    var pubFileName = '';\n+    var pubMimeType = '';\n+    req.busboy.on('file', (fieldname, file, fileName, encoding, mimeType) => {\n+      var buffer = '';\n+      pubFileName = fileName;\n+      pubMimeType = mimeType;\n+      file.setEncoding('base64');\n+      file.on('data', function(data) {\n+        buffer += data;\n+      }).on('end', function() {\n+        base64data.push(buffer);\n+      });\n+    }).on('finish', function() {\n+      var f = new AV.File(pubFileName, {\n+        // 仅上传第一个文件（多个文件循环创建）\n+        base64: base64data[0]\n+      });\n+      try {\n+        f.save().then(function(fileObj) {\n+          // 向客户端返回数据\n+          res.send({\n+            fileId: fileObj.id,\n+            fileName: fileObj.name(),\n+            mimeType: fileObj.metaData().mime_type,\n+            fileUrl: fileObj.url()\n+          });\n+        });\n+      } catch (err) {\n+        console.log('uploadFile - ' + err);\n+        res.status(502);\n+      }\n+    })\n+    req.pipe(req.busboy);\n+  } else {\n+    console.log('uploadFile - busboy undefined.');\n+    res.status(502);\n+  }\n+};\n+```\n+\n+{% endblock %}\n+{% block text_upload_file_with_progress %}{% endblock %}\n+{% block text_download_file_with_progress %}{% endblock %}\n+{% block code_file_image_thumbnail %}\n+\n+```js\n+  //获得宽度为100像素，高度200像素的缩略图\n+  var url = file.thumbnailURL(100, 200);\n+```\n+```ts\n+  //获得宽度为100像素，高度200像素的缩略图\n+  let thumbnailURL = file.thumbnailURL(100,200);\n+```\n+{% endblock %}\n+\n+{% block code_file_metadata %}\n+\n+```js\n+    // 获取文件大小\n+    var size = file.size();\n+    // 上传者(AV.User) 的 objectId，如果未登录，默认为空\n+    var ownerId = file.ownerId();\n+\n+    // 获取文件的全部元信息\n+    var metadata = file.metaData();\n+    // 设置文件的作者\n+    file.metaData('author', 'LeanCloud');\n+    // 获取文件的格式\n+    var format = file.metaData('format');\n+```\n+``` ts\n+  // 获取文件大小\n+  let size = file.size();\n+  // 上传者(AV.User) 的 objectId，如果未登录，默认为空\n+  let ownerId = file.ownerId();\n+\n+  // 获取文件的全部元信息\n+  let metadata = file.metaData();\n+  // 设置文件的作者\n+  file.metaData('author','LeanCloud');\n+  // 获取文件的格式\n+  let format = file.metaData('format');\n+```\n+{% endblock %}\n+\n+{% block code_download_file %}\n+```objc\n+    [file getDataInBackgroundWithBlock:^(NSData *data, NSError *error) {\n+        // data 就是文件的数据流\n+    } progressBlock:^(NSInteger percentDone) {\n+        //下载的进度数据，percentDone 介于 0 和 100。\n+    }];\n+```\n+{% endblock %}\n+\n+{% block code_file_delete %}\n+\n+```js\n+  var file = AV.File.createWithoutData('552e0a27e4b0643b709e891e');\n+  file.destroy().then(function (success) {\n+  }, function (error) {\n+  });\n+```\n+```ts\n+  let file:AV.File = AV.File.createWithoutData('552e0a27e4b0643b709e891e');\n+  file.destroy().then((success)=>{\n+  },(error)=>{\n+  });\n+```\n+{% endblock %}\n+\n+{% block code_cache_operations_file %}{% endblock %}\n+\n+{% block text_https_access_for_ios9 %}{% endblock %}\n+\n+{% block code_create_query_by_className %}\n+\n+```js\n+  var query = new AV.Query('Todo');\n+```\n+```ts\n+  let query: AV.Query= new AV.Query('Todo');\n+```\n+{% endblock %}\n+\n+{% block code_priority_equalTo_zero_query %}\n+\n+```js\n+  var query = new AV.Query('Todo');\n+  // 查询 priority 是 0 的 Todo\n+  query.equalTo('priority', 0);\n+  query.find().then(function (results) {\n+      var priorityEqualsZeroTodos = results;\n+  }, function (error) {\n+  });\n+```\n+```ts\n+  let query: AV.Query= new AV.Query('Todo');\n+  // 查询 priority 是 0 的 Todo\n+  query.equalTo('priority',0);\n+  query.find<AV.Object []>().then((results)=>{\n+    let priorityEqualsZeroTodos : Array<AV.Object> =results;\n+  },(error)=>{\n+\n+  });\n+```\n+{% endblock %}\n+\n+{% block code_priority_equalTo_zero_and_one_wrong_example %}\n+\n+```js\n+  var query = new AV.Query('Todo');\n+  query.equalTo('priority', 0);\n+  query.equalTo('priority', 1);\n+  query.find().then(function (results) {\n+  // 如果这样写，第二个条件将覆盖第一个条件，查询只会返回 priority = 1 的结果\n+  }, function (error) {\n+  });\n+```\n+```ts\n+  let query: AV.Query= new AV.Query('Todo');\n+  query.equalTo('priority',0);\n+  query.equalTo('priority',1);\n+  query.find<AV.Object []>().then((results)=>{\n+    // 如果这样写，第二个条件将覆盖第一个条件，查询只会返回 priority = 1 的结果\n+  },(error)=>{\n+  });\n+```\n+{% endblock %}\n+\n+{% block table_logic_comparison_in_query %}\n+逻辑操作 | AVQuery 方法|\n+---|---\n+等于 | `equalTo`\n+不等于 |  `notEqualTo`\n+大于 | `greaterThan`\n+大于等于 | `greaterThanOrEqualTo`\n+小于 | `lessThan`\n+小于等于 | `lessThanOrEqualTo`\n+{% endblock %}\n+\n+{% block code_query_lessThan %}\n+\n+```js\n+  var query = new AV.Query('Todo');\n+  query.lessThan('priority', 2);\n+```\n+```ts\n+  let query: AV.Query= new AV.Query('Todo');\n+  query.lessThan('priority',2);\n+```\n+{% endblock %}\n+\n+{% block code_query_greaterThanOrEqualTo %}\n+\n+```js\n+  query.greaterThanOrEqualTo('priority',2);\n+```\n+```ts\n+  query.greaterThanOrEqualTo('priority',2);\n+```\n+{% endblock %}\n+\n+{% block code_query_with_regular_expression %}\n+\n+```js\n+  var query = new AV.Query('Todo');\n+  var regExp = new RegExp('[\\u4e00-\\u9fa5]', 'i');\n+  query.matches('title', regExp);\n+  query.find().then(function (results) {\n+  }, function (error) {\n+  });\n+```\n+```ts\n+  let query: AV.Query= new AV.Query('Todo');\n+  let regExp : RegExp = new RegExp('[\\u4e00-\\u9fa5]','i');\n+  query.matches('title',regExp);\n+  query.find<AV.Object []>().then((results)=>{\n+  },(error)=>{\n+  });\n+```\n+{% endblock %}\n+\n+{% block code_query_with_contains_keyword %}\n+\n+```js\n+  query.contains('title','李总');  \n+```\n+```ts\n+  query.contains('title','李总');  \n+```\n+{% endblock %}\n+\n+{% block code_query_with_not_contains_keyword_using_regex %}\n+\n+```js\n+  var query = new AV.Query('Todo');\n+  var regExp = new RegExp('^((?!机票).)*$', 'i');\n+  query.matches('title', regExp);\n+```\n+```ts\n+  let query: AV.Query= new AV.Query('Todo');\n+  let regExp : RegExp = new RegExp('^((?!机票).)*$','i');\n+  query.matches('title',regExp);\n+```\n+{% endblock %}\n+\n+{% block code_query_with_not_contains_keyword %}\n+\n+```js\n+  var query = new AV.Query('Todo');\n+  var filterArray = ['出差', '休假'];\n+  query.notContainedIn('title', filterArray);\n+```\n+```ts\n+  let query: AV.Query= new AV.Query('Todo');\n+  let filterArray : Array<string> = ['出差','休假'];\n+  query.notContainedIn('title',filterArray);\n+```\n+{% endblock %}\n+\n+{% block code_query_array_contains_using_equalsTo %}\n+\n+```js\n+  var query = new AV.Query('Todo');\n+  var reminderFilter = [new Date('2015-11-11 08:30:00')];\n+  query.containsAll('reminders', reminderFilter);\n+```\n+```ts\n+  let query: AV.Query= new AV.Query('Todo');\n+  let reminderFilter: Array<Date> = [new Date('2015-11-11 08:30:00')];\n+  query.containsAll('reminders',reminderFilter);\n+```\n+{% endblock %}\n+\n+{% block code_query_array_contains_all %}\n+\n+```js\n+  var query = new AV.Query('Todo');\n+  var reminderFilter = [new Date('2015-11-11 08:30:00'), new Date('2015-11-11 09:30:00')];\n+  query.equalTo('reminders', reminderFilter);\n+```\n+```ts\n+  let query: AV.Query= new AV.Query('Todo');\n+  let reminderFilter: Array<Date> = [new Date('2015-11-11 08:30:00'),new Date('2015-11-11 09:30:00')];\n+  query.equalTo('reminders',reminderFilter);\n+```\n+{% endblock %}\n+\n+{% block code_query_whereHasPrefix %}\n+\n+```js\n+  // 找出开头是「早餐」的 Todo\n+  var query = new AV.Query('Todo');\n+  query.startsWith('content', '早餐');\n+```\n+```ts\n+  // 找出开头是「早餐」的 Todo\n+  let query: AV.Query= new AV.Query('Todo');\n+  query.startsWith('content','早餐');\n+```\n+{% endblock %}\n+\n+{% block code_query_comment_by_todoFolder %}\n+\n+```js\n+  var query = new AV.Query('Todo');\n+  var todoFolder = AV.Object.createWithoutData('Todo', '5735aae7c4c9710060fbe8b0');\n+  query.equalTo('targetTodoFolder', todoFolder);\n+```\n+```ts\n+  let query: AV.Query= new AV.Query('Todo');\n+  let todoFolder : AV.Object = AV.Object.createWithoutData('Todo','5735aae7c4c9710060fbe8b0');\n+  query.equalTo('targetTodoFolder',todoFolder);\n+```\n+{% endblock %}\n+\n+{% block code_create_tag_object %}\n+\n+```js\n+  var tag = new AV.Object('Todo');\n+  tag.set('name', '今日必做');\n+  tag.save();\n+```\n+```ts\n+  let tag: AV.Object= new AV.Object('Todo');\n+  tag.set('name','今日必做');\n+  tag.save();\n+```\n+{% endblock %}\n+\n+{% block code_create_family_with_tag %}\n+\n+```js\n+  var tag1 = new AV.Object('Todo');\n+  tag1.set('name', '今日必做');\n+\n+  var tag2 = new AV.Object('Todo');\n+  tag2.set('name', '老婆吩咐');\n+\n+  var tag3 = new AV.Object('Todo');\n+  tag3.set('name', '十分重要');\n+\n+  var tags = [tag1, tag2, tag3];\n+  AV.Object.saveAll(tags).then(function (savedTags) {\n+\n+      var todoFolder = new AV.Object('TodoFolder');\n+      todoFolder.set('name', '家庭');\n+      todoFolder.set('priority', 1);\n+\n+      var relation = todoFolder.relation('tags');\n+      relation.add(tag1);\n+      relation.add(tag2);\n+      relation.add(tag3);\n+\n+      todoFolder.save();\n+  }, function (error) {\n+  });\n+```\n+```ts\n+  let tag1: AV.Object= new AV.Object('Todo');\n+  tag1.set('name','今日必做');\n+\n+  let tag2: AV.Object= new AV.Object('Todo');\n+  tag2.set('name','老婆吩咐');\n+\n+  let tag3: AV.Object= new AV.Object('Todo');\n+  tag3.set('name','十分重要');\n+\n+  let tags:Array<AV.Object> = [tag1,tag2,tag3];\n+\n+  AV.Object.saveAll<AV.Object []>(tags).then((savedTags)=>{\n+    let todoFolder:AV.Object = new AV.Object('TodoFolder');\n+    todoFolder.set('name','家庭');\n+    todoFolder.set('priority',1);\n+\n+    let relation : AV.Relation = todoFolder.relation('tags');\n+    relation.add(tag1);\n+    relation.add(tag2);\n+    relation.add(tag3);\n+\n+    todoFolder.save();\n+  },(error)=>{\n+\n+  });\n+```\n+{% endblock %}\n+\n+{% block code_query_tag_for_todoFolder %}\n+\n+```js\n+  var todoFolder = AV.Object.createWithoutData('Todo', '5735aae7c4c9710060fbe8b0');\n+  var relation = todoFolder.relation('tags');\n+  var query = relation.query();\n+  query.find().then(function (results) {\n+    // results 是一个 AV.Object 的数组，它包含所有当前 todoFolder 的 tags\n+  }, function (error) {\n+  });\n+```\n+```ts\n+  let todoFolder : AV.Object = AV.Object.createWithoutData('Todo','5735aae7c4c9710060fbe8b0');\n+  let relation : AV.Relation = todoFolder.relation('tags');\n+  let query : AV.Query = relation.query();\n+  query.find<AV.Object []>().then((results)=>{\n+    // results 是一个 AV.Object 的数组，它包含所有当前 todoFolder 的 tags\n+  },(error)=>{\n+\n+  });\n+```\n+{% endblock %}\n+\n+{% block code_query_todoFolder_with_tag %}\n+\n+```js\n+  var targetTag = AV.Object.createWithoutData('Tag', '5655729900b0bf3785ca8192');\n+  var query = new AV.Query('TodoFolder');\n+  query.equalTo('tags', targetTag);\n+  query.find().then(function (results) {\n+  // results 是一个 AV.Object 的数组\n+  // results 指的就是所有包含当前 tag 的 TodoFolder\n+  }, function (error) {\n+  });\n+```\n+```ts\n+  let targetTag : AV.Object = AV.Object.createWithoutData('Tag','5655729900b0bf3785ca8192');\n+  let query: AV.Query= new AV.Query('TodoFolder');\n+  query.equalTo('tags',targetTag);\n+  query.find<AV.Object []>().then((results)=>{\n+    // results 是一个 AV.Object 的数组\n+    // results 指的就是所有包含当前 tag 的 TodoFolder\n+  },(error)=>{\n+\n+  });\n+```\n+{% endblock %}\n+\n+{% block code_query_comment_include_todoFolder %}\n+\n+```js\n+  var commentQuery = new AV.Query('Comment');\n+  commentQuery.descending('createdAt');\n+  commentQuery.limit(10);\n+  commentQuery.include('targetTodoFolder');// 关键代码，用 includeKey 告知服务端需要返回的关联属性对应的对象的详细信息，而不仅仅是 objectId\n+  commentQuery.find().then(function (comments) {\n+      // comments 是最近的十条评论, 其 targetTodoFolder 字段也有相应数据\n+      for (var i = 0; i < comments.length; i++) {\n+          var comment = comments[i];\n+          // 并不需要网络访问\n+          var todoFolder = comment.get('targetTodoFolder');\n+      }\n+  }, function (error) {\n+  });\n+```\n+```ts\n+  let commentQuery: AV.Query = new AV.Query('Comment');\n+  commentQuery.descending('createdAt');\n+  commentQuery.limit(10);\n+  commentQuery.include('targetTodoFolder');// 关键代码，用 includeKey 告知服务端需要返回的关联属性对应的对象的详细信息，而不仅仅是 objectId\n+  commentQuery.find<AV.Object []>().then((comments)=>{\n+    // comments 是最近的十条评论, 其 targetTodoFolder 字段也有相应数据\n+    for(let comment of comments){\n+      // 并不需要网络访问\n+      let todoFolder = comment.get('targetTodoFolder');\n+    }\n+  },(error)=>{\n+\n+  });\n+```\n+{% endblock %}\n+\n+{% block code_query_comment_match_query_todoFolder %}\n+\n+```js\n+  // 构建内嵌查询\n+  var innerQuery = new AV.Query('TodoFolder');\n+  innerQuery.greaterThan('likes', 20);\n+\n+  // 将内嵌查询赋予目标查询\n+  var query = new AV.Query('Comment');\n+\n+  // 执行内嵌操作\n+  query.matchesQuery('targetTodoFolder', innerQuery);\n+  query.find().then(function (results) {\n+     // results 就是符合超过 20 个赞的 TodoFolder 这一条件的 Comment 对象集合\n+  }, function (error) {\n+  });\n+\n+  query.doesNotMatchQuery('targetTodoFolder', innerQuery);\n+  // 如此做将查询出 likes 小于或者等于 20 的 TodoFolder 的 Comment 对象\n+```\n+```ts\n+  // 构建内嵌查询\n+  let innerQuery: AV.Query = new AV.Query('TodoFolder');\n+  innerQuery.greaterThan('likes',20);\n+\n+  // 将内嵌查询赋予目标查询\n+  let query: AV.Query = new AV.Query('Comment');\n+\n+  // 执行内嵌操作\n+  query.matchesQuery('targetTodoFolder',innerQuery);\n+\n+  query.find<AV.Object []>().then((results)=>{\n+    // results 就是符合超过 20 个赞的 TodoFolder 这一条件的 Comment 对象集合\n+  },(error)=>{\n+\n+  });\n+\n+  query.doesNotMatchQuery('targetTodoFolder',innerQuery);\n+  // 如此做将查询出 likes 小于或者等于 20 的 TodoFolder 的 Comment 对象\n+```\n+{% endblock %}\n+\n+{% block code_query_find_first_object %}\n+\n+```js\n+  var query = new AV.Query('Comment');\n+  query.equalTo('priority', 0);\n+  query.first().then(function (data) {\n+    // data 就是符合条件的第一个 AV.Object\n+  }, function (error) {\n+  });\n+```\n+```ts\n+  let query: AV.Query = new AV.Query('Comment');\n+  query.equalTo('priority',0);\n+  query.first<AV.Object>().then((data)=>{\n+    // data 就是符合条件的第一个 AV.Object\n+  },(error)=>{\n+  });\n+```\n+{% endblock %}\n+\n+{% block code_set_query_limit %}\n+\n+```js\n+  var query = new AV.Query('Todo');\n+  var now = new Date();\n+  query.lessThanOrEqualTo('createdAt', now);//查询今天之前创建的 Todo\n+  query.limit(10);// 最多返回 10 条结果\n+```\n+```ts\n+  let query: AV.Query = new AV.Query('Todo');\n+  let now : Date = new Date();\n+  query.lessThanOrEqualTo('createdAt',now);//查询今天之前创建的 Todo\n+  query.limit(10);// 最多返回 10 条结果\n+```\n+{% endblock %}\n+\n+{% block code_set_skip_for_pager %}\n+\n+```js\n+  var query = new AV.Query('Todo');\n+  var now = new Date();\n+  query.lessThanOrEqualTo('createdAt', now);//查询今天之前创建的 Todo\n+  query.limit(10);// 最多返回 10 条结果\n+  query.skip(20);// 跳过 20 条结果\n+```\n+```ts\n+  let query: AV.Query = new AV.Query('Todo');\n+  let now : Date = new Date();\n+  query.lessThanOrEqualTo('createdAt',now);//查询今天之前创建的 Todo\n+  query.limit(10);// 最多返回 10 条结果\n+  query.skip(20);  // 跳过 20 条结果\n+```\n+\n+{% endblock %}\n+\n+{% block code_query_select_keys %}\n+\n+```js\n+  var query = new AV.Query('Todo');\n+  query.select('title', 'content');\n+  query.find().then(function (results) {\n+      for (var i = 0； i < results.length; i++) {\n+          var todo = results[i];\n+          var title = todo.get('title');\n+          var content = todo.get('content');\n+          var location_1 = todo.get('location');\n+      }\n+  }, function (error) {\n+  });\n+```\n+```ts\n+  let query: AV.Query = new AV.Query('Todo');\n+  // 指定返回的属性\n+  query.select('title','content');\n+  query.find<AV.Object []>().then((results)=>{\n+    for(let todo of results){\n+      let title = todo.get('title');\n+      let content = todo.get('content');\n+\n+      // 如果访问没有指定返回的属性（key），则会报错，在当前这段代码中访问 location 属性就会报错\n+      let location = todo.get('location');\n+    }\n+  },(error)=>{\n+\n+  });\n+```\n+{% endblock %}\n+\n+{% block code_query_count %}\n+\n+```js\n+  var query = new AV.Query('Todo');\n+  query.equalTo('status', 1);\n+  query.count().then(function (count) {\n+      console.log(count);\n+  }, function (error) {\n+  });\n+```\n+```ts\n+  let query: AV.Query = new AV.Query('Todo');\n+  query.equalTo('status',1);\n+  query.count<number>().then((count)=>{\n+    console.log(count);\n+  },(error)=>{\n+\n+  });\n+```\n+{% endblock %}\n+\n+{% block code_query_orderby %}\n+\n+```js\n+  // 按时间，升序排列\n+  query.ascending('createdAt');\n+\n+  // 按时间，降序排列\n+  query.descending('createdAt');\n+```\n+```ts\n+  // 按时间，升序排列\n+  query.ascending('createdAt');\n+\n+  // 按时间，降序排列\n+  query.descending('createdAt');\n+```\n+{% endblock %}\n+\n+{% block code_query_orderby_on_multiple_keys %}\n+\n+```js\n+  var query = new AV.Query('Todo');\n+  query.ascending('priority');\n+  query.descending('createdAt');\n+```\n+```ts\n+  let query: AV.Query = new AV.Query('Todo');\n+  query.ascending('priority');\n+  query.descending('createdAt');\n+```\n+{% endblock %}\n+\n+{% block code_query_with_or %}\n+\n+```js\n+  var priorityQuery = new AV.Query('Todo');\n+  priorityQuery.greaterThanOrEqualTo('priority', 3);\n+\n+  var statusQuery = new AV.Query('Todo');\n+  statusQuery.equalTo('status', 1);\n+\n+  var query = AV.Query.or(priorityQuery, statusQuery);\n+  // 返回 priority 大于等于 3 或 status 等于 1 的 Todo\n+```\n+```ts\n+  let priorityQuery: AV.Query = new AV.Query('Todo');\n+  priorityQuery.greaterThanOrEqualTo('priority',3);\n+\n+  let statusQuery: AV.Query = new AV.Query('Todo');\n+  statusQuery.equalTo('status',1);\n+\n+  let query : AV.Query =  AV.Query.or(priorityQuery,statusQuery);\n+  // 返回 priority 大于等于 3 或 status 等于 1 的 Todo\n+```\n+{% endblock %}\n+\n+{% block code_query_with_and %}\n+\n+```js\n+  var priorityQuery = new AV.Query('Todo');\n+  priorityQuery.greaterThanOrEqualTo('priority', 3);\n+\n+  var statusQuery = new AV.Query('Todo');\n+  statusQuery.equalTo('status', 1);\n+\n+  var query = AV.Query.and(priorityQuery, statusQuery);\n+  // 返回 priority 小于 3 并且 status 等于 0 的 Todo\n+```\n+```ts\n+  let priorityQuery: AV.Query = new AV.Query('Todo');\n+  priorityQuery.greaterThanOrEqualTo('priority',3);\n+\n+  let statusQuery: AV.Query = new AV.Query('Todo');\n+  statusQuery.equalTo('status',1);\n+\n+  let query : AV.Query =  AV.Query.and(priorityQuery,statusQuery);\n+  // 返回 priority 小于 3 并且 status 等于 0 的 Todo\n+```\n+{% endblock %}\n+\n+{% block code_query_where_keys_exist %}\n+\n+```js\n+  var aTodoAttachmentImage = AV.File.withURL('attachment.jpg', 'http://www.zgjm.org/uploads/allimg/150812/1_150812103912_1.jpg');\n+  var todo = new AV.Object('Todo');\n+  todo.set('images', aTodoAttachmentImage);\n+  todo.set('content', '记得买过年回家的火车票！！！');\n+  todo.save();\n+\n+  var query = new AV.Query('Todo');\n+  query.exists('images');\n+  query.find().then(function (results) {\n+    // results 返回的就是有图片的 Todo 集合\n+  }, function (error) {\n+  });\n+\n+  // 使用空值查询获取没有图片的 Todo\n+  query.doesNotExist('images');\n+```\n+```ts\n+  let aTodoAttachmentImage : AV.File = AV.File.withURL('attachment.jpg','http://www.zgjm.org/uploads/allimg/150812/1_150812103912_1.jpg');\n+  let todo: AV.Object = new AV.Object('Todo');\n+  todo.set('images',aTodoAttachmentImage);\n+  todo.set('content','记得买过年回家的火车票！！！');\n+  todo.save();\n+\n+  let query : AV.Query = new AV.Query('Todo');\n+  query.exists('images');\n+  query.find<AV.Object []>().then((results)=>{\n+    // results 返回的就是有图片的 Todo 集合\n+  },(error)=>{\n+\n+  });\n+\n+  // 使用空值查询获取没有图片的 Todo\n+  query.doesNotExist('images');\n+```\n+{% endblock %}\n+\n+{% block code_query_by_cql %}\n+\n+```js\n+  var cql = 'select * from %@ where status = 1';\n+  AV.Query.doCloudQuery(cql).then(function (data) {\n+      // results 即为查询结果，它是一个 AV.Object 数组\n+      var results = data.results;\n+  }, function (error) {\n+  });\n+  cql = 'select * from %@ where status = 1';\n+  AV.Query.doCloudQuery(cql).then(function (data) {\n+      // 获取符合查询的数量\n+      var count = data.count;\n+  }, function (error) {\n+  });\n+```\n+```ts\n+  let cql : string = 'select * from %@ where status = 1';\n+  AV.Query.doCloudQuery<any>(cql).then((data)=>{\n+    let results = data.results;\n+    // results 即为查询结果，它是一个 AV.Object 数组\n+  },(error)=>{\n+\n+  });\n+\n+  cql  = 'select * from %@ where status = 1';\n+  AV.Query.doCloudQuery<any>(cql).then((data)=>{\n+     let count = data.count;\n+     // count 是 number 类型\n+  },(error)=>{\n+\n+  });\n+```\n+{% endblock %}\n+\n+{% block code_query_by_cql_with_placeholder %}\n+\n+```js\n+  // 带有占位符的 cql 语句\n+  var cql = 'select * from %@ where status = ? and priority = ?';\n+  var pvalues = [0, 1];\n+  AV.Query.doCloudQuery(cql, pvalues).then(function (data) {\n+      // results 即为查询结果，它是一个 AV.Object 数组\n+      var results = data.results;\n+  }, function (error) {\n+  });\n+```\n+```ts\n+  // 带有占位符的 cql 语句\n+  let cql : string = 'select * from %@ where status = ? and priority = ?';\n+  let pvalues = [0,1];\n+  AV.Query.doCloudQuery<any>(cql,pvalues).then((data)=>{\n+     let results = data.results;\n+     // results 即为查询结果，它是一个 AV.Object 数组\n+  },(error)=>{\n+\n+  });\n+```\n+{% endblock %}\n+\n+{% block text_query_cache_intro %}{% endblock %}\n+\n+{% block code_set_cache_policy %}{% endblock %}\n+\n+{% block table_cache_policy %}{% endblock %}\n+\n+{% block code_query_geoPoint_near %}\n+\n+```js\n+  var query = new AV.Query('Todo');\n+  var point = new AV.GeoPoint('39.9', '116.4');\n+  query.limit(10);\n+  query.near('whereCreated', point);\n+```\n+```ts\n+  let query : AV.Query = new AV.Query('Todo');\n+  let point : AV.GeoPoint = new AV.GeoPoint('39.9','116.4');\n+  query.limit(10);\n+  query.near('whereCreated',point);\n+```\n+\n+在上面的代码中，`nearbyTodos` 返回的是与 `point` 这一点按距离排序（由近到远）的对象数组。注意：**如果在此之后又使用了 `orderByAscending:` 或 `orderByDescending:` 方法，则按距离排序会被新排序覆盖。**","path":"views/leanstorage_guide-js.md","position":1787,"original_position":1787,"commit_id":"73f9fdbb24a84768d34c6616ebaf537031897538","original_commit_id":"73f9fdbb24a84768d34c6616ebaf537031897538","user":{"login":"myleslee","id":108758,"avatar_url":"https://avatars.githubusercontent.com/u/108758?v=3","gravatar_id":"","url":"https://api.github.com/users/myleslee","html_url":"https://github.com/myleslee","followers_url":"https://api.github.com/users/myleslee/followers","following_url":"https://api.github.com/users/myleslee/following{/other_user}","gists_url":"https://api.github.com/users/myleslee/gists{/gist_id}","starred_url":"https://api.github.com/users/myleslee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/myleslee/subscriptions","organizations_url":"https://api.github.com/users/myleslee/orgs","repos_url":"https://api.github.com/users/myleslee/repos","events_url":"https://api.github.com/users/myleslee/events{/privacy}","received_events_url":"https://api.github.com/users/myleslee/received_events","type":"User","site_admin":false},"body":"`orderByAscending:` 或 `orderByDescending:` 是 OC 的方法？","created_at":"2016-05-19T08:39:25Z","updated_at":"2016-05-19T08:39:25Z","html_url":"https://github.com/leancloud/docs/pull/1168#discussion_r63841273","pull_request_url":"https://api.github.com/repos/leancloud/docs/pulls/1168","_links":{"self":{"href":"https://api.github.com/repos/leancloud/docs/pulls/comments/63841273"},"html":{"href":"https://github.com/leancloud/docs/pull/1168#discussion_r63841273"},"pull_request":{"href":"https://api.github.com/repos/leancloud/docs/pulls/1168"}}},"pull_request":{"url":"https://api.github.com/repos/leancloud/docs/pulls/1168","id":70292404,"html_url":"https://github.com/leancloud/docs/pull/1168","diff_url":"https://github.com/leancloud/docs/pull/1168.diff","patch_url":"https://github.com/leancloud/docs/pull/1168.patch","issue_url":"https://api.github.com/repos/leancloud/docs/issues/1168","number":1168,"state":"open","locked":false,"title":"Js refactor","user":{"login":"wujun4code","id":5119542,"avatar_url":"https://avatars.githubusercontent.com/u/5119542?v=3","gravatar_id":"","url":"https://api.github.com/users/wujun4code","html_url":"https://github.com/wujun4code","followers_url":"https://api.github.com/users/wujun4code/followers","following_url":"https://api.github.com/users/wujun4code/following{/other_user}","gists_url":"https://api.github.com/users/wujun4code/gists{/gist_id}","starred_url":"https://api.github.com/users/wujun4code/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wujun4code/subscriptions","organizations_url":"https://api.github.com/users/wujun4code/orgs","repos_url":"https://api.github.com/users/wujun4code/repos","events_url":"https://api.github.com/users/wujun4code/events{/privacy}","received_events_url":"https://api.github.com/users/wujun4code/received_events","type":"User","site_admin":false},"body":"## 本次提交产生的影响\r\n 1. JavaScript 数据存储采用 leanstorage_guide.tmpl 作为模板重写\r\n 2. JavaScript 数据存储一并提供了 TypeScript 写法的 sample code\r\n\r\n## 尚未完成的部分\r\n 1. JavaScript 关系建模指南以及 ACL 指南\r\n 2. TypeScript 的安装指南\r\n\r\n综上，先针对 leanstorage_guide-js.md 做 review，与其外链的文档后续补上\r\n\r\n@myleslee ","created_at":"2016-05-17T02:46:36Z","updated_at":"2016-05-19T08:39:25Z","closed_at":null,"merged_at":null,"merge_commit_sha":"589b59de3c61c48e1d37ba93d98a7d1b4136b8b3","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/leancloud/docs/pulls/1168/commits","review_comments_url":"https://api.github.com/repos/leancloud/docs/pulls/1168/comments","review_comment_url":"https://api.github.com/repos/leancloud/docs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/leancloud/docs/issues/1168/comments","statuses_url":"https://api.github.com/repos/leancloud/docs/statuses/73f9fdbb24a84768d34c6616ebaf537031897538","head":{"label":"wujun4code:js_refactor","ref":"js_refactor","sha":"73f9fdbb24a84768d34c6616ebaf537031897538","user":{"login":"wujun4code","id":5119542,"avatar_url":"https://avatars.githubusercontent.com/u/5119542?v=3","gravatar_id":"","url":"https://api.github.com/users/wujun4code","html_url":"https://github.com/wujun4code","followers_url":"https://api.github.com/users/wujun4code/followers","following_url":"https://api.github.com/users/wujun4code/following{/other_user}","gists_url":"https://api.github.com/users/wujun4code/gists{/gist_id}","starred_url":"https://api.github.com/users/wujun4code/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wujun4code/subscriptions","organizations_url":"https://api.github.com/users/wujun4code/orgs","repos_url":"https://api.github.com/users/wujun4code/repos","events_url":"https://api.github.com/users/wujun4code/events{/privacy}","received_events_url":"https://api.github.com/users/wujun4code/received_events","type":"User","site_admin":false},"repo":{"id":29326977,"name":"docs","full_name":"wujun4code/docs","owner":{"login":"wujun4code","id":5119542,"avatar_url":"https://avatars.githubusercontent.com/u/5119542?v=3","gravatar_id":"","url":"https://api.github.com/users/wujun4code","html_url":"https://github.com/wujun4code","followers_url":"https://api.github.com/users/wujun4code/followers","following_url":"https://api.github.com/users/wujun4code/following{/other_user}","gists_url":"https://api.github.com/users/wujun4code/gists{/gist_id}","starred_url":"https://api.github.com/users/wujun4code/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wujun4code/subscriptions","organizations_url":"https://api.github.com/users/wujun4code/orgs","repos_url":"https://api.github.com/users/wujun4code/repos","events_url":"https://api.github.com/users/wujun4code/events{/privacy}","received_events_url":"https://api.github.com/users/wujun4code/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/wujun4code/docs","description":"LeanCloud Documentation","fork":true,"url":"https://api.github.com/repos/wujun4code/docs","forks_url":"https://api.github.com/repos/wujun4code/docs/forks","keys_url":"https://api.github.com/repos/wujun4code/docs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wujun4code/docs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wujun4code/docs/teams","hooks_url":"https://api.github.com/repos/wujun4code/docs/hooks","issue_events_url":"https://api.github.com/repos/wujun4code/docs/issues/events{/number}","events_url":"https://api.github.com/repos/wujun4code/docs/events","assignees_url":"https://api.github.com/repos/wujun4code/docs/assignees{/user}","branches_url":"https://api.github.com/repos/wujun4code/docs/branches{/branch}","tags_url":"https://api.github.com/repos/wujun4code/docs/tags","blobs_url":"https://api.github.com/repos/wujun4code/docs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wujun4code/docs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wujun4code/docs/git/refs{/sha}","trees_url":"https://api.github.com/repos/wujun4code/docs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wujun4code/docs/statuses/{sha}","languages_url":"https://api.github.com/repos/wujun4code/docs/languages","stargazers_url":"https://api.github.com/repos/wujun4code/docs/stargazers","contributors_url":"https://api.github.com/repos/wujun4code/docs/contributors","subscribers_url":"https://api.github.com/repos/wujun4code/docs/subscribers","subscription_url":"https://api.github.com/repos/wujun4code/docs/subscription","commits_url":"https://api.github.com/repos/wujun4code/docs/commits{/sha}","git_commits_url":"https://api.github.com/repos/wujun4code/docs/git/commits{/sha}","comments_url":"https://api.github.com/repos/wujun4code/docs/comments{/number}","issue_comment_url":"https://api.github.com/repos/wujun4code/docs/issues/comments{/number}","contents_url":"https://api.github.com/repos/wujun4code/docs/contents/{+path}","compare_url":"https://api.github.com/repos/wujun4code/docs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wujun4code/docs/merges","archive_url":"https://api.github.com/repos/wujun4code/docs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wujun4code/docs/downloads","issues_url":"https://api.github.com/repos/wujun4code/docs/issues{/number}","pulls_url":"https://api.github.com/repos/wujun4code/docs/pulls{/number}","milestones_url":"https://api.github.com/repos/wujun4code/docs/milestones{/number}","notifications_url":"https://api.github.com/repos/wujun4code/docs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wujun4code/docs/labels{/name}","releases_url":"https://api.github.com/repos/wujun4code/docs/releases{/id}","deployments_url":"https://api.github.com/repos/wujun4code/docs/deployments","created_at":"2015-01-16T01:31:32Z","updated_at":"2016-04-12T06:46:28Z","pushed_at":"2016-05-17T03:38:01Z","git_url":"git://github.com/wujun4code/docs.git","ssh_url":"git@github.com:wujun4code/docs.git","clone_url":"https://github.com/wujun4code/docs.git","svn_url":"https://github.com/wujun4code/docs","homepage":"http://leancloud.cn/docs/","size":35158,"stargazers_count":0,"watchers_count":0,"language":"CSS","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"leancloud:master","ref":"master","sha":"4b75612706af73f73dc272ed49e4dc1b7872350e","user":{"login":"leancloud","id":6660518,"avatar_url":"https://avatars.githubusercontent.com/u/6660518?v=3","gravatar_id":"","url":"https://api.github.com/users/leancloud","html_url":"https://github.com/leancloud","followers_url":"https://api.github.com/users/leancloud/followers","following_url":"https://api.github.com/users/leancloud/following{/other_user}","gists_url":"https://api.github.com/users/leancloud/gists{/gist_id}","starred_url":"https://api.github.com/users/leancloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leancloud/subscriptions","organizations_url":"https://api.github.com/users/leancloud/orgs","repos_url":"https://api.github.com/users/leancloud/repos","events_url":"https://api.github.com/users/leancloud/events{/privacy}","received_events_url":"https://api.github.com/users/leancloud/received_events","type":"Organization","site_admin":false},"repo":{"id":25067518,"name":"docs","full_name":"leancloud/docs","owner":{"login":"leancloud","id":6660518,"avatar_url":"https://avatars.githubusercontent.com/u/6660518?v=3","gravatar_id":"","url":"https://api.github.com/users/leancloud","html_url":"https://github.com/leancloud","followers_url":"https://api.github.com/users/leancloud/followers","following_url":"https://api.github.com/users/leancloud/following{/other_user}","gists_url":"https://api.github.com/users/leancloud/gists{/gist_id}","starred_url":"https://api.github.com/users/leancloud/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/leancloud/subscriptions","organizations_url":"https://api.github.com/users/leancloud/orgs","repos_url":"https://api.github.com/users/leancloud/repos","events_url":"https://api.github.com/users/leancloud/events{/privacy}","received_events_url":"https://api.github.com/users/leancloud/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/leancloud/docs","description":"LeanCloud Documentation","fork":false,"url":"https://api.github.com/repos/leancloud/docs","forks_url":"https://api.github.com/repos/leancloud/docs/forks","keys_url":"https://api.github.com/repos/leancloud/docs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/leancloud/docs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/leancloud/docs/teams","hooks_url":"https://api.github.com/repos/leancloud/docs/hooks","issue_events_url":"https://api.github.com/repos/leancloud/docs/issues/events{/number}","events_url":"https://api.github.com/repos/leancloud/docs/events","assignees_url":"https://api.github.com/repos/leancloud/docs/assignees{/user}","branches_url":"https://api.github.com/repos/leancloud/docs/branches{/branch}","tags_url":"https://api.github.com/repos/leancloud/docs/tags","blobs_url":"https://api.github.com/repos/leancloud/docs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/leancloud/docs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/leancloud/docs/git/refs{/sha}","trees_url":"https://api.github.com/repos/leancloud/docs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/leancloud/docs/statuses/{sha}","languages_url":"https://api.github.com/repos/leancloud/docs/languages","stargazers_url":"https://api.github.com/repos/leancloud/docs/stargazers","contributors_url":"https://api.github.com/repos/leancloud/docs/contributors","subscribers_url":"https://api.github.com/repos/leancloud/docs/subscribers","subscription_url":"https://api.github.com/repos/leancloud/docs/subscription","commits_url":"https://api.github.com/repos/leancloud/docs/commits{/sha}","git_commits_url":"https://api.github.com/repos/leancloud/docs/git/commits{/sha}","comments_url":"https://api.github.com/repos/leancloud/docs/comments{/number}","issue_comment_url":"https://api.github.com/repos/leancloud/docs/issues/comments{/number}","contents_url":"https://api.github.com/repos/leancloud/docs/contents/{+path}","compare_url":"https://api.github.com/repos/leancloud/docs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/leancloud/docs/merges","archive_url":"https://api.github.com/repos/leancloud/docs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/leancloud/docs/downloads","issues_url":"https://api.github.com/repos/leancloud/docs/issues{/number}","pulls_url":"https://api.github.com/repos/leancloud/docs/pulls{/number}","milestones_url":"https://api.github.com/repos/leancloud/docs/milestones{/number}","notifications_url":"https://api.github.com/repos/leancloud/docs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/leancloud/docs/labels{/name}","releases_url":"https://api.github.com/repos/leancloud/docs/releases{/id}","deployments_url":"https://api.github.com/repos/leancloud/docs/deployments","created_at":"2014-10-11T07:14:37Z","updated_at":"2016-05-19T07:57:50Z","pushed_at":"2016-05-19T07:42:39Z","git_url":"git://github.com/leancloud/docs.git","ssh_url":"git@github.com:leancloud/docs.git","clone_url":"https://github.com/leancloud/docs.git","svn_url":"https://github.com/leancloud/docs","homepage":"http://leancloud.cn/docs/","size":37765,"stargazers_count":257,"watchers_count":257,"language":"CSS","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":155,"mirror_url":null,"open_issues_count":80,"forks":155,"open_issues":80,"watchers":257,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/leancloud/docs/pulls/1168"},"html":{"href":"https://github.com/leancloud/docs/pull/1168"},"issue":{"href":"https://api.github.com/repos/leancloud/docs/issues/1168"},"comments":{"href":"https://api.github.com/repos/leancloud/docs/issues/1168/comments"},"review_comments":{"href":"https://api.github.com/repos/leancloud/docs/pulls/1168/comments"},"review_comment":{"href":"https://api.github.com/repos/leancloud/docs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/leancloud/docs/pulls/1168/commits"},"statuses":{"href":"https://api.github.com/repos/leancloud/docs/statuses/73f9fdbb24a84768d34c6616ebaf537031897538"}}}}