2
我有用戶記錄,每個用戶都有一個好友列表。更新記錄推送數組中的唯一值Node.js + MongoDB
如何只推送用戶記錄中的朋友數組中的唯一值?
accounts.update({user:nickNameField}, {$push:{"friends":friendsName}}, { upsert:true },
function (e, res) {
...
或者我需要手動檢查值是否在朋友陣列?