|
@@ -389,7 +389,7 @@ class UserModel extends BaseModel {
|
|
|
|
|
|
async getContacts(userID) {
|
|
|
const user = await this.model.findOne({_id: mongoose.Types.ObjectId(userID)}, 'contacts').lean();
|
|
|
- if (!user) {
|
|
|
+ if (!user || !user.contacts || !user.contacts.length) {
|
|
|
return [];
|
|
|
}
|
|
|
const userIDList = user.contacts.map(item => mongoose.Types.ObjectId(item.userID));
|