Skip to content

Instantly share code, notes, and snippets.

@heffo42
Last active July 7, 2019 19:06
Show Gist options
  • Save heffo42/42bccaf6cf334e868a711bdc96344efc to your computer and use it in GitHub Desktop.
Save heffo42/42bccaf6cf334e868a711bdc96344efc to your computer and use it in GitHub Desktop.
def writeTweets(tweets):
'''
See Extraction_Exapmple.py to see how to parse tweets into newTweetRecords
'''
try:
result = collection.insert_many(newTweetRecords, ordered=False)
i += len(newTweetRecords)
except pymongo.errors.BulkWriteError as e:
panic = list(filter(lambda x: x['code'] != 11000, e.details['writeErrors']))
if len(panic) > 0:
print(e)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment