【发布时间】:2022-01-15 04:31:21
【问题描述】:
我有两个分开的模型名称员工和用户,它们有一些共同的数据和一个帐户 ID 来相互链接。每种型号的记录如下:
Employee
_id:1639137618164
name:"*****"
sites:Array
company:”Software”
jobTitle: “Associate Software Engineer”
email:"*****"
phonesms:"1"
phonevoice:"1"
licenseNumber:""
avatarStamp:0
pined:false
accountId: 1639129314021 //link attribute
countryCodeSms:"US"
countryCodeVoice:"US"
inviteCode:"09611"
emergencyRoles: Object
invite: "booksRbUoSM"
对于用户是
_id:1639129314021
firstName:"*** ***"
lastName:"****"
companyName:"SITS"
passwordReset:""
activated:true
accountId:1639129314021 // link attribute
siteId:-1
role:0
last:1639137913873
blocked:false
blockedtext:""
trialend:1640338913781
paytype:1
hashAccess:Array
emergencyEnabled:false
visitorTypes:Array
sitesLimit:2
manualCreation:false
username:"*************"
password:"**********************************"
email:"*********************"
passwordNotification:true
passwordLifecycle:1646906375986
isNewUser:true
listFeature:Object
我想从用户模型中搜索是否存在具有该 accountId 的任何员工,是否有与 accountId 关联的员工,然后使用可用的公共数据添加新员工。否则不是。我怎样才能在环回中做到这一点。我被困在这里了!
【问题讨论】:
标签: javascript mongodb loopbackjs