Closed Charlotte-Holt closed 3 years ago
@Charlotte-Holt , for section Implementing Create operation, you mentioned not to monospace "create". Should that apply to then entire guide and also for "update", "delete" and "read"?
@meswan Yes, that's right
Global changes
What you’ll learn
Additional Prerequisites
Try what you'll build
The TWYB section is nested under "Setting up MongoDB" because it is a pre-requisite to have the mongoDB running first in order to run the TWYB section. Should TWYB and "Setting up MongoDB" both be nested under "Getting started" or leave as is?
Setting up MongoDB
Configuring the server
[ ] Move this section to after the "Performing CRUD operations" sections and before the "Running the application" section.
[x] The two paragraphs that begin "The features required to create the CDI producer..." and "Additionally, the Secure Sockets Layer..." spend a lot of time explaining what can be seen in the code. I also don't think we need the info related to how MongoDB previously worked. I'd suggest collapsing them down into one paragraph, something like, "The features that are required to create the CDI producer for MongoDB are cdi-2.0, ssl-1.0, mpConfig-1.4, and passwordUtilities-1.0, which are all specified in the featureManager element. The Secure Sockets Layer (SSL) context is configured in the server.xml file so that the application can connect to MongoDB with TLS. The keyStore element is configured to point to the truststore.p12 keystore file that was created in one of the earlier sections. The ssl element is configured to use the defaultKeyStore as the keystore and outboundTrustStore as the truststore." - The only hotspots I'd use in this paragraph are featureManager, keyStore, and ssl.
[x] "Using MicroProfile Config makes configuring the MongoDB driver simple since all the configuration can be set in one place and injected into the CDI producer." --> "Using MicroProfile Config makes configuring the MongoDB driver simple because all of the configuration can be set in one place and injected into the CDI producer."
[x] Suggested update for the paragraph that begins "Properties such as..." - "Properties such as the hostname, port, and database name for the running MongoDB instance are set in this file. Additionally, the user’s username and password are set here. For added security, the password was encoded by using the securityUtility encode command." - I also don't think that you need to hotspot any of these, as it seems very clear to me which is which in the short file.
[ ] "For reference on how the encoded password was generated, navigate to the target/liberty/wlp/bin/ directory in a separate command-line session and run the following command:" - Do users need to do this to complete the guide? If not, I'm thinking just linking to the securityUtility encode documentation is sufficient and this bit at the end can be taken out entirely.
Using a CDI producer for MongoDB
[x] "With a CDI producer, you are no longer restricted to MongoDB 2.x versions, and can easily provide a MongoDatabase to your microservice." --> "With a CDI producer, you can easily provide a MongoDatabase to your microservice."
[x] Collapse the second and third paragraphs into one. Suggested update: "This class contains a producer method for the MongoClient, a producer method for the MongoDatabase that uses the MongoClient producer method, and a dispose method for the MongoClient. Before you create the methods, the values in the microprofile-config.properties file are injected into the MongoProducer class."
[x] The last three paragraphs of this section rely heavily on describing what's happening in the code, but they don't necessarily tell me why these things are important or need to happen. I suggest collapsing these three paragraphs down into two, something like, "The createMongo() method returns an instance of MongoClient. In this method, the username, database name, and decoded password are passed into the MongoCredential.createCredential() method to get an instance of MongoCredential. The JSSEHelper is used to get the SSLContext from the outboundSSLContext in the server.xml file. Then, a MongoClient instance is created and returned. - In this paragraph, only hotspot "createMongo()", "MongoCredential.createCredential()", "JSSEHelper", and the final instance of "MongoClient".
The createDB() method returns an instance of MongoDatabase. This method injects the MongoClient in its parameters and passes the database name into the MongoClient.getDatabase() method to get a MongoDatabase instance. The close() method is a cleanup function for the MongoClient that closes the connection to the MongoDB instance." - In this paragraph, only hotspot "createDB()", "MongoClient.getDatabase()", and "close()". Then, add a sentence or two to each paragraph that explains why these points that we're highlighting are important.
Performing CRUD operations
Go to the http://localhost:9080/openapi/ui/ URL to see the OpenAPI UI that provides API documentation and a client to test the API endpoints you'll create."
Implementing Create operation
Implementing Read operation
Implementing Update operation
{id}
parameter is the<<ID>>
that you saved from the create operation. Use the following code as the request body:Implementing Delete operation
{id}
parameter is the<<ID>>
that you saved from the create operation. This request removes the document that contains the specified crew member object id from the collection. You will receive a response that contains the object id of the deleted crew member:Running the application
Testing the application
Running the tests
Tearing down the environment
Nice work! Where to next?