Created
January 9, 2021 21:22
-
-
Save stfsy/9171233b115c346167f910073a931d42 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pymongo | |
mongoClient = pymongo.MongoClient( | |
"mongodb://localhost:27017/", username="removed", password="removed") | |
mongoDatabase = mongoClient["twitter"] | |
mongoCollection = mongoDatabase["tweets"] | |
def fetch_next_tweet_without_classification(): | |
result = list(mongoCollection.aggregate([ | |
{ | |
'$project': { | |
'id': True, 'text': True, 'classification': True, 'lang': True | |
} | |
}, | |
{ | |
'$match': {"classification": None} | |
}, | |
{ | |
'$match': {"lang": { | |
'$eq': 'en' | |
}} | |
}, | |
{ | |
'$limit': 1 | |
} | |
])) | |
return result[0] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment