zoukankan      html  css  js  c++  java
  • nodeclub models

    之前看过keystone的结构,所以现在看nodeclub时,总会和keystone进行比较。

    nodeclub models会有一个index来作为facade,通过它连接mongodb,exports具体的model

    在keystone中,models没有连接mongodb的部分,也没有index作为facade,直接require 文件夹名,把各具体的model作为它的属性来使用。keystone 连接mongodb的在哪呢?

    mongoose.connect(uri, options)

    options的参数如下

    db - passed to the connection db instance
    server - passed to the connection server instance(s)
    replset - passed to the connection ReplSet instance
    user - username for authentication (if not specified in uri)
    pass - password for authentication (if not specified in uri)
    auth - options for authentication
    mongos - Boolean - if true, enables High Availability support for mongos

    process.exit(1):退出并返回失败的状态 ('failure' code);执行上述代码,用来执行 node 的 shell 就能收到值为 1 的 exit code

    如果不require,应该也可以吧,没有赋给变量,也没有使用

    user的数据划分很好,.index建立索引,-1反向 unique唯一性

    schema.plugin(): 使用插件,schema.plugin(model):对schema使用model

    现在看的版本中去掉了tag和relation

    敲完了models,也就熟悉了nodeclub中models的使用。

  • 相关阅读:
    ceph集群jewel版本 rbd 块map 报错-故障排查
    基本的Ceph性能测试工具和方法
    dd命令的高级应用
    Ceph recover的速度控制
    Linux mount命令
    Centos7.2:搭建Ceph管理系统Inscope
    rpm --import /etc/pki/rpm-gpg/RPM* 有什么用?
    dd命令的解释
    Playbooks 中的错误处理
    Ansible之Playbooks的when语句
  • 原文地址:https://www.cnblogs.com/wang-jing/p/4870826.html
Copyright © 2011-2022 走看看