Replace id to _id for fetch user mongoose

This commit is contained in:
Jim Laurie 2017-12-14 15:14:53 +01:00
parent 5962052287
commit c7ef225238
10 changed files with 14 additions and 9 deletions

View File

@ -55,4 +55,4 @@
"npm": ">= 5.3.0"
},
"license": "MIT"
}
}

View File

@ -46,4 +46,4 @@
"npm": ">= 5.3.0"
},
"license": "MIT"
}
}

View File

@ -43,4 +43,4 @@
"npm": ">= 5.3.0"
},
"license": "MIT"
}
}

View File

@ -43,4 +43,4 @@
"npm": ">= 5.3.0"
},
"license": "MIT"
}
}

View File

@ -43,4 +43,4 @@
"npm": ">= 5.3.0"
},
"license": "MIT"
}
}

View File

@ -47,4 +47,4 @@
"npm": ">= 5.3.0"
},
"license": "MIT"
}
}

View File

@ -44,4 +44,4 @@
"npm": ">= 5.3.0"
},
"license": "MIT"
}
}

View File

@ -43,4 +43,4 @@
"npm": ">= 5.3.0"
},
"license": "MIT"
}
}

View File

@ -43,4 +43,4 @@
"npm": ">= 5.3.0"
},
"license": "MIT"
}
}

View File

@ -16,6 +16,11 @@ module.exports = {
},
findOne: async function (params) {
if (!params[this.primaryKey] && params.id) {
params[this.primaryKey] = params.id;
delete params.id;
}
return this
.findOne(params)
.populate(this.associations.map(x => x.alias).join(' '));