上一页 1 ··· 830 831 832 833 834 835 836 837 838 ··· 851 下一页
摘要: 译者:飞龙 来源:ejs 嵌入式 JavaScript 模板 安装 $ npm install ejs 特性 <% %> 用于控制流<%= %> 用于转义的输出<%- %> 用于非转义的输出-%> 结束标签用于换行移除模式带有<%_ _%>的控制流使用空白字符移除模式自定义分隔符 (例如,使用 ‘ 阅读全文
posted @ 2016-01-11 17:05 绝不原创的飞龙 阅读(71) 评论(0) 推荐(0)
摘要: 译者:飞龙 来源:Object Relational Mapping 安装 npm install orm 所支持的Node.js版本 支持 0.8, 0.10, 0.12, iojs-1.5 。 0.10.x,0.12.x 和 iojs-1.5 版本的测试在 Travis CI 上运行。如果你想要 阅读全文
posted @ 2016-01-10 17:56 绝不原创的飞龙 阅读(26) 评论(0) 推荐(0)
摘要: 译者:飞龙 来源:Aggregation 如果你需要从一个模型中获取一些聚合值,你可以使用Model.aggregate()。下面通过一个例子来展示: Person.aggregate({ surname: "Doe" }).min("age").max("age").get(function (e 阅读全文
posted @ 2016-01-10 17:27 绝不原创的飞龙 阅读(9) 评论(0) 推荐(0)
摘要: 译者:飞龙 来源:Creating and Updating Items 创建 var newRecord = {}; newRecord.id = 1; newRecord.name = "John" Person.create(newRecord, function(err, results) 阅读全文
posted @ 2016-01-10 17:16 绝不原创的飞龙 阅读(10) 评论(0) 推荐(0)
摘要: 译者:飞龙 来源:Finding items find 查找匹配标准的记录,可以链式查询(见下文): Person.find({status:'active'}, function(err, results) { // ... }); 你也可以限制结果的个数,这条语句限制结果为10个: Person 阅读全文
posted @ 2016-01-10 17:13 绝不原创的飞龙 阅读(10) 评论(0) 推荐(0)
摘要: 译者:飞龙 来源:Syncing and dropping models 同步是一项功能方法,可以在数据库里为你的模型和关联创建所需的表来工作。现存的表并不会被替换,它们只会在不存在的时候被创建。 同步有两种方式: 调用Model.sync(cb)会仅仅同步指定模型调用db.sync(cb)会同步所 阅读全文
posted @ 2016-01-10 16:57 绝不原创的飞龙 阅读(14) 评论(0) 推荐(0)
摘要: 译者:飞龙 来源:extendsTo 你可能想把可选的属性分割到另一个表中。每个扩展都会是一个新的表,其中每一行的唯一标识符是主模型实例的id。 例如: var Person = db.define("person", { name : String }); var PersonAddress = 阅读全文
posted @ 2016-01-10 16:51 绝不原创的飞龙 阅读(13) 评论(0) 推荐(0)
摘要: 译者:飞龙 来源:hasMany hasMany 是多对多的关系(包括连接表)。 例如:Patient.hasMany('doctors', Doctor, { why: String }, { reverse: 'patients', key: true })。 病人可以拥有许多不同的医生。每个医 阅读全文
posted @ 2016-01-10 16:38 绝不原创的飞龙 阅读(10) 评论(0) 推荐(0)
摘要: 译者:飞龙 来源:hasOne hasOne关联是一种多对一的关系,意思是你定义的模型可以有多个实例指向一个其它的实例(所属相同模型或不同模型)。 用法 Animal.hasOne(association_name [, association_model [, options ] ]); 描述 a 阅读全文
posted @ 2016-01-10 15:49 绝不原创的飞龙 阅读(12) 评论(0) 推荐(0)
摘要: 译者:飞龙 来源:Defining Associations 关联是一个或多个[模型之间](3. Defining Models.md)的关系。 关联的类型: [hasOne(一对多)](4.1 hasOne.md)[hasMany(多对多)](4.2 hasMany.md)[extendsTo(一 阅读全文
posted @ 2016-01-10 12:12 绝不原创的飞龙 阅读(8) 评论(0) 推荐(0)
上一页 1 ··· 830 831 832 833 834 835 836 837 838 ··· 851 下一页