This function gets the tweets from a specific user.
In order to get tweets from a specific user from the tweets collection, we need to modify our current list_tweet(user_id) function as follows:
def list_tweet(user_id): db = connection.cloud_native.tweets api_list=[] tweet = db.find({'id':user_id}) for i in tweet: api_list.append(str(i)) if api_list == []: abort(404) return jsonify({'tweet': api_list})
Let's test out our API and validate whether it is working as expected or not: