title: How to update an element in every document with a unique value in pymongo
body: <p>I am working on building sample data for a school project. I want some of the numbers to look unique. I have two arrays</p>
  <pre><code>for_sale_prices = [&quot;$50,000&quot;, &quot;$100,000&quot;, &quot;$200,000&quot;, &quot;$300,000&quot;,'$400,000', &quot;$500,000&quot;, &quot;$600,000&quot;,'$700,000', &quot;$800,000&quot;, &quot;$900,000&quot;]
  for_rent_prices = [&quot;$60&quot;, &quot;$70&quot;, &quot;$80&quot;, &quot;$90&quot;,'$100', &quot;$110&quot;, &quot;$120&quot;,'$130', &quot;$140&quot;, &quot;$150&quot;]
  </code></pre>
  <p>I want to add a price field to every document with a number randomly chosen from the above arrarys. I looked into update_many but that gives every document the same price and I tried this...</p>
  <pre><code>for_sale.aggregate([
      { &quot;$project&quot;: {
                        &quot;_id&quot;: True, 
                        &quot;name&quot;: True,
                        &quot;description&quot;: True,
                        &quot;picture_url&quot;: True,
                        &quot;host_name&quot;: True,
                        &quot;neighbourhood&quot;: True,
                        &quot;location&quot;: True,
                        &quot;bathrooms_text&quot;: True,
                        &quot;bedrooms&quot;: True,
                        &quot;amenities&quot;: True,
                        &quot;price&quot;: for_sale_prices[random.randint(0,9)]
                    }
      }, 
      { &quot;$out&quot;: &quot;for_sale&quot;}
  ])
  </code></pre>
  <p>which doesn't even create a price field. I have yet to find anyone with a similar problem online and would appreciate any guidance.</p>