【文件属性】:
文件名称:mongoose-exists:猫鼬验证,以确保存在引用的对象ID
文件大小:56KB
文件格式:ZIP
更新时间:2021-02-03 13:28:12
mongoose ensure exists mongooose-plugin mongoose-exists
猫鼬存在
猫鼬验证,以确保引用的对象ID存在。
要求
NodeJS v10 +
猫鼬v5.5 +
安装
$ npm install --save mongoose-exists
用法
const mongoose = require ( 'mongoose' ) ;
const exists = require ( 'mongoose-exists' ) ;
const PersonSchema = new mongoose . Schema ( {
name : { type : String } ,
father : { type : ObjectId , ref : 'Person' , exists : true } ,
mother : { type : ObjectId , ref : 'Person' , exists : { refresh : true } }
} ) ;
PersonSchema . plugin ( exists ) ;
Person . create ( { } , function ( error , created
【文件预览】:
mongoose-exists-master
----.jshintrc(384B)
----.gitignore(571B)
----.jsbeautifyrc(93B)
----package.json(2KB)
----.npmrc(63B)
----package-lock.json(161KB)
----.travis.yml(102B)
----CONTRIBUTING.md(8KB)
----Gruntfile.js(1KB)
----CODE_OF_CONDUCT.md(3KB)
----index.js(5KB)
----CHANGELOG.md(10KB)
----README.md(3KB)
----.npmignore(164B)
----test()
--------exists.spec.js(6KB)
--------bootstrap.spec.js(145B)