title: pymongo.insert_many() of dataframe with series-column
body: <p><a href="https://i.stack.imgur.com/fuJ4Y.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fuJ4Y.png" alt="enter image description here" /></a></p>
  <p>We have the following pandas dataframe <code>my_df</code> that we are attempting to insert into mongo with <code>pymongo.insert_many()</code>. We have a collection named <code>our_col</code> in mongodb, and have the following, however we are receiving an error:</p>
  <pre><code>db['our_col'].drop() # Drop Previous Table 
  db['our_col'].insert_many(my_df.to_dict('records')) # And Insert
  </code></pre>
  <p><code>InvalidDocument: cannot encode object: 27694, of type: &lt;class 'numpy.int64'&gt;</code></p>
  <p>this is presumably because the <code>competitionIds</code> field is an array field. Mongo should be able to handle nested fields like this, and so how can we do this insert into mongo from python with the series-column? Is this possible with pymongo?</p>
  <p><a href="https://i.stack.imgur.com/swSJhm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/swSJhm.png" alt="enter image description here" /></a></p>