Github : https://github.com/balderdashy/waterline

文档 : https://github.com/balderdashy/waterline-docs

Waterline 是通过Adapter关联不同的数据库, (不同的数据库由不同的 Adapter 来关联)

module.exports = {
    identity: 'user',
    adapter: 'default',
    attributes: {
        username: {
            type: 'string',
            unique: true
        },
        email: {
            type: 'email',
            unique: true
        },
        password: {
            type: 'string'
        },
        toJSON: function() {
            var obj = this.toObject();
            delete obj.password;
            return obj;
        }
    }
};

指定了adapter来关联不同的数据库//TODO 待实践

在Sails.js中 config/connections.js 下,修改

someMongodbServer: {
    adapter: 'sails-mongo',
    host: 'localhost',
    port: 27017,
    user: '',
    password: '',
    database: 'riceServer'
  },

在config/models.js 下修改 connection: 'someMongodbServer'

与你相遇好幸运,Waterline初遇的更多相关文章

  1. 与你相遇好幸运,Waterline的多表关联

    >一对一关联 表示一个模型可能只与另一个模型关联.为了使模型知道它与其他哪些模型关联,外键必需包含在记录中.. http://imfly.github.io/sails-docs/concept ...

  2. 与你相遇好幸运,Waterline的属性

    >支持的数据类型: string / text / integer / float / date / time / datetime / boolean / binary / array / j ...

  3. 与你相遇好幸运,My Toolkit of Nodejs

    >测试:restler.mocha.assert.request.request-promise >安装:nrm >运维:pm2.node-gyp >开发:nodemon.in ...

  4. 与你相遇好幸运,async解决循环回调问题

    由于使用的sailsjs框架,用的是sailsjs自身带的ORm(就是waterline),ORM的默认数据库的返回值在回调里面. > arg是一个数组 count用来计数用 tmpArr临时存 ...

  5. 与你相遇好幸运,Sails.js安装

    官网: http://sailsjs.org Github:https://github.com/balderdashy/sails 开发文档: http://sailsjs.org/document ...

  6. 与你相遇好幸运,使用redis设置定时任务

    参考链接: Nodejs中使用Redis来完成定时任务 自己在 window 7下编码实现: 1 > 首先查看redis版本: redis-server -v , 版本要求大于等于2.8 2&g ...

  7. 与你相遇好幸运,制作自己的Yeoman Generator

    使用别人写好的生成器: npm install -g yonpm install -g generator-angularyo angular 如何自己制作符合自己心仪的生成器呢: https://g ...

  8. 与你相遇好幸运,gen8安装

    gen8到手后,立马去买了 SSD https://item.jd.com/2010277.html 支架 https://item.jd.com/2671609.html NAS盘 https:// ...

  9. 与你相遇好幸运,德淘gen8历程

    应该是十月底了 , 在浏览色魔张大妈(smzdm) http://www.smzdm.com/p/6517684/ 的时候看见了这个 , 以前大学就想买个这个 , 苦于没钱.... 然后当时打算买 , ...

随机推荐

  1. UIView的layoutSubviews和drawRect

    原文: UIView的layoutSubviews和drawRect UIView的setNeedsDisplay和setNeedsLayout方法.首先两个方法都是异步执行的.setNeedsDis ...

  2. 38 网络相关函数(六)——live555源码阅读(四)网络

    38 网络相关函数(六)——live555源码阅读(四)网络 38 网络相关函数(六)——live555源码阅读(四)网络 简介 12)makeSocketNonBlocking和makeSocket ...

  3. 网页的title左边的小图片怎么添加

    首先,代码中的title标签里是不能加图片的.但是浏览器标提栏前面是可以加一个小图标的. 解决方案:第一步,做一个16 X 16像素的ico格式的图标.具体操作方法是,先在Photoshop中做一个透 ...

  4. React 源码解读参考,理解原理。

    Rubix - ReactJS Powered Admin Template 文档:   http://rubix-docs.sketchpixy.com/ ===================== ...

  5. C#之GDI+

    1.使用Brushes填充矩形区域 Graphics g = e.Graphics; g.FillRectangle(Brushes.Green, , , , )); 2.使用LinearGradie ...

  6. poj 1789

    http://poj.org/problem?id=1789 这是一道图论的题,个人觉得和那个POJ1258是差不多的,就是多了一步,题目难以读懂 题目的意思:就是给你一群字符串要你找字符串对应的字符 ...

  7. C# 读写十六进制bin 文件

    读一个十六进制的bin文件,在bin文件添加四行头,生成新的bin文件.bin文件可以用vs打开查看. using System; using System.Collections.Generic; ...

  8. Node.js 字体格式转换 ttf2eot ttf2woff ttf2svg

    前几天为了查找字体转换工具网上搜索,既然用 Node.js 来做的工具. https://github.com/fontello/ttf2eot https://github.com/fontello ...

  9. metro压缩和解压文件

    在1.zip中增加一张新图片StorageFile jpg = await KnownFolders.PicturesLibrary.GetFileAsync("1.jpg"); ...

  10. [转]Git远程操作详解

    原文:http://www.ruanyifeng.com/blog/2014/06/git_remote.html Git是目前最流行的版本管理系统,学会Git几乎成了开发者的必备技能. Git有很多 ...