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的使用。

  • 相关阅读:
    ubuntu python opencv3 cv2.cv2 has no attribute 'face' 'cv2.face' has no attribute 'createEigenFaceRecognizer'
    python opencv3 摄像头人脸检测
    python opencv3 静态图片检测人脸
    python opencv3 grabcut前景检测
    python opencv3 圆检测
    python opencv3 直线检测
    lua--clone
    LoadingController
    粒子加到骨骼中
    CCShatteredTiles3D
  • 原文地址:https://www.cnblogs.com/wang-jing/p/4870826.html
Copyright © 2011-2022 走看看