问题 I am using mongoose. I want to create a document chat with an array users (including userId1 , userId2 ), if I do not find it: This is how I do: ChatModel.findOneAndUpdate( { users: { $all: [userId1, userId2] }}, { $setOnInsert: { users: [userId1, userId2] }}, { upsert: true }) .exec() .catch(err => console.log(err)); But I got the error: MongoError: cannot infer query fields to set, path 'users' is matched twice This is Chat Schema: { users: [{ type: Schema.Types.ObjectId, ref: 'User' }],