title: Mongoose: cannot infer query fields to set, path 'participants' is matched twice
body: <p>I'm using mongoose with Node.js to create a document of <code>chat</code> with <code>participants</code> as one of the fields if the chat doesn't exist. </p>
  
  <p>If it does exist then simply increment the status to 1 or any number.</p>
  
  <p>My current Solution: </p>
  
  <pre><code> try {
  
     let query = { participants: { $all: [CURRENT_USER_ID, TARGETED_ID] } };
     let update = { $inc: { status: 1 }};
     let options = { upsert: true, new: true };
     let chat = await Chat.findOneAndUpdate(
        query,
        update,
        options
     ).exec();
     console.log(chat);
  
    } catch (err) {
  
      console.log(err.message);
  
    }
  </code></pre>
  
  <p>I will receive an error </p>
  
  <blockquote>
    <p>"cannot infer query fields to set, path 'participants' is matched
    twice"</p>
  </blockquote>
  
  <p>I even use this <a href="https://stackoverflow.com/questions/39060861/mongoerror-cannot-infer-query-fields-to-set-path-users-is-matched-twice">solution</a> and it doesn't work, it created an empty list of participants instead.</p>
  
  <pre><code>let query = {
         participants: {
           $all: [
             { $elemMatch: { $eq: CURRENT_USER_ID } },
             { $elemMatch: { $eq: TARGETED_ID } }
           ]
         }
       };
  </code></pre>
  
  <p>Any help would be really helpful. Thanks</p>