title: OverflowError: MongoDB can only handle up to 8-byte ints?
body: <p>I have spent the last 12 hours scouring the web. I am completely lost, please help. </p>
  
  <p>I am trying to pull data from an API endpoint and put it into MongoDB. The data looks like this: </p>
  
  <pre><code>{"_links": {
      "self": {
        "href": "https://us.api.battle.net/data/sc2/ladder/271302?namespace=prod"
      }
    },
    "league": {
      "league_key": {
        "league_id": 5,
        "season_id": 37,
        "queue_id": 201,
        "team_type": 0
      },
      "key": {
        "href": "https://us.api.battle.net/data/sc2/league/37/201/0/5?namespace=prod"
      }
    },
    "team": [
      {
        "id": 6956151645604413000,
        "rating": 5321,
        "wins": 131,
        "losses": 64,
        "ties": 0,
        "points": 1601,
        "longest_win_streak": 15,
        "current_win_streak": 4,
        "current_rank": 1,
        "highest_rank": 10,
        "previous_rank": 1,
        "join_time_stamp": 1534903699,
        "last_played_time_stamp": 1537822019,
        "member": [
          {
            "legacy_link": {
              "id": 9964871,
              "realm": 1,
              "name": "mTOR#378",
              "path": "/profile/9964871/1/mTOR"
            },
            "played_race_count": [
              {
                "race": "Zerg",
                "count": 195
              }
            ],
            "character_link": {
              "id": 9964871,
              "battle_tag": "Hellghost#11903",
              "key": {
                "href": "https://us.api.battle.net/data/sc2/character/Hellghost-11903/9964871?namespace=prod"
              }
            }
          }
        ]
      },
      {
        "id": 11611747760398664000, .....
  ....
  </code></pre>
  
  <p>Here's the code: </p>
  
  <pre><code>for ladder_number in ladder_array:
      ladder_call_url = ladder_call+slash+str(ladder_number)+eng_locale+access_token
      url = str(ladder_call_url)
      response = requests.get(url)
      print('trying ladder number '+str(ladder_number))
      print('calling :'+url)
      if response.status_code == 200:
          print('status: '+str(response))
          mmr_db.ladders.insert_one(response.json())
  </code></pre>
  
  <p>I get an error:</p>
  
  <blockquote>
    <p>OverflowError: MongoDB can only handle up to 8-byte ints?</p>
  </blockquote>
  
  <p>Is this because the data I am trying to load is too large? Are the "ID" integers too large? </p>
  
  <p>Oh man, any help would be sincerely appreciated. </p>
  
  <p>_______ EDIT ____________</p>
  
  <p>Edited to include the Traceback: </p>
  
  <pre><code>Traceback (most recent call last):
    File "C:\scripts\mmr_from_ladders.py", line 96, in &lt;module&gt;
      mmr_db.ladders.insert_one(response.json(), bypass_document_validation=True)
    File "C:\Users\me\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pymongo\collection.py", line 693, in insert_one
      session=session),
    File "C:\Users\me\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pymongo\collection.py", line 607, in _insert
      bypass_doc_val, session)
    File "C:\Users\me\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pymongo\collection.py", line 595, in _insert_one
      acknowledged, _insert_command, session)
    File "C:\Users\me\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pymongo\mongo_client.py", line 1243, in _retryable_write
      return self._retry_with_session(retryable, func, s, None)
    File "C:\Users\me\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pymongo\mongo_client.py", line 1196, in _retry_with_session
      return func(session, sock_info, retryable)
    File "C:\Users\me\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pymongo\collection.py", line 590, in _insert_command
      retryable_write=retryable_write)
    File "C:\Users\me\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pymongo\pool.py", line 584, in command
      self._raise_connection_failure(error)
    File "C:\Users\me\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pymongo\pool.py", line 745, in _raise_connection_failure
      raise error
    File "C:\Users\me\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pymongo\pool.py", line 579, in command
      unacknowledged=unacknowledged)
    File "C:\Users\me\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pymongo\network.py", line 114, in command
      codec_options, ctx=compression_ctx)
    File "C:\Users\me\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pymongo\message.py", line 679, in _op_msg
      flags, command, identifier, docs, check_keys, opts)
  OverflowError: MongoDB can only handle up to 8-byte ints
  </code></pre>