Flask CRUD Operation with mongodb

Viewed 15

I loaded a file into mongodb,i want to get some specific keys and not all.This code gives me all the keys but I want specific keys.The aim is to create a flask API that gets some specific keys from the database. This is my code

    app =Flask(__name__)
    @app.route('/feeds', methods=["GET"])
    def get():
      documents = collection.find()
      response = []
      for document in documents:
        document['_id'] = str(document['_id'])
        response.append(document)
        return json.dumps(response)
0 Answers
Related