title: Mongoose update or insert many documents
body: <p>I'm trying to use the latest version of mongoose to insert an array of objects, or update if a corresponding product id already exists. I can't for the life of me figure out the right method to use (bulkWrite, updateMany etc) and I can't can't seem to figure out the syntax without getting errors. For example, i'm trying</p>
  
  <pre><code>Product.update({}, products, { upsert : true, multi : true }, (err, docs) =&gt; console.log(docs))
  </code></pre>
  
  <p>this throws the error <code>DeprecationWarning: collection.update is deprecated. Use updateOne, updateMany, or bulkWrite instead. MongoError: '$set' is empty. You must specify a field like so: {$set: {&lt;field&gt;: ...}</code></p>
  
  <p>and using updateMany just gives me the $set error. I can't seem to find any examples of people using this method, just wondering if somebody can provide me with an example of how to properly use this.</p>
  
  <p>To be clear, I generate an array of objects, then I want to insert them into my db, or update the entry if it already exists. The field I want to match on is called <code>pid</code>. Any tips or advice would be greatly appreciated!</p>
  
  <p>EDIT: </p>
  
  <p>My product schema</p>
  
  <pre><code>const productSchema = new mongoose.Schema({
    title : String,
    image : String,
    price_was : Number,
    price_current : {
      dollars : String,
      cents : String
    },
    price_save_percent : String,
    price_save_dollars : String,
    price_save_endtime : String,
    retailer : String
  })
  
  const Product = mongoose.model('Product', productSchema)
  </code></pre>
  
  <p>an example of the <code>products</code> array being passed</p>
  
  <pre><code>[
    {   
    title: 'SOME PRODUCT',
    image: '',
    price_was: '139.99',
    price_current: { dollars: '123', cents: '.49' },
    price_save_percent: '12%',
    price_save_dollars: '16.50',
    price_save_endtime: null,
    pid: 'VB78237321',
    url: '' 
    },
    { ... },
    { ... }
  ]
  </code></pre>