Final Answer:
The BackEnd application run as web server using express having a REST API. 1.1 To create a MongoDB collection named "CovidData" to hold the data from the given CSV file, use the command: `db.createCollection("CovidData")`.
1.2 Create a mongoose Schema in a separate JS file, for example, "CovidSchema.js," and define a model to be used in queries for adding, deleting, updating, and finding data.
1.3 In another file, say "DatabaseConnection.js," import the mongoose Schema created in 1.2 and establish a connection with MongoDB using `mongoose.connect()`.
1.4 In the "server.js" file, run a web server using Express. Import the files created in 1.2 and 1.3, and configure the necessary routes and middleware.
1.5 Add a POST method in the REST API that uses the created model to add data (number of cases, deaths, state, and date) to the "CovidData" collection in MongoDB.
1.6 Implement a separate POST method for updating cases, deaths, and date for a given state using the model and Schema created earlier.
1.7 Create a separate GET method to show the total number of cases and deaths for a given state by querying the "CovidData" collection.
1.8 Implement a POST method for deleting a record (cases and deaths) for a given state using the model and Schema.
1.9 Add an endpoint with a POST method to display the first 20 records from the "CovidData" collection for a given state where the number of deaths is greater than a specified value entered by the user.
Step-by-step explanation:
The provided steps guide the development of a Node.js application using Express and MongoDB to handle COVID-19 data. Steps 1.1 to 1.4 involve setting up the database, schema, and server. Steps 1.5 to 1.8 describe adding, updating, retrieving, and deleting data using the REST API. Step 1.9 specifies an endpoint for displaying filtered data based on user input.
In this scenario, MongoDB is chosen for its flexibility with JSON-like documents, suitable for storing COVID-19 data. Mongoose, a MongoDB object modeling tool, facilitates schema creation and provides a straightforward way to interact with the database in a Node.js environment. Express simplifies the creation of a web server, handling routes and middleware efficiently.
The described architecture aligns with common practices in Node.js application development, emphasizing modularization, separation of concerns, and adherence to RESTful principles. The combination of MongoDB, Mongoose, and Express forms a robust stack for building scalable and maintainable web applications, particularly suited for handling data-centric operations like those related to COVID-19 statistics.