For Chapter 2 Ticket: Create/Update Comments UpdateCreateCommentTest id invalid issue

More specifically, the test method “testAddCommentUsingObjectId”, as the code below:

  @Test
  public void testAddCommentUsingObjectId() {
    String id = "619e483309f8c99feb5c87a2";
    Comment comment = dao.getComment(id);
    Assert.assertNotNull(comment);
  }
  1. The first question is about the id value “619e483309f8c99feb5c87a2”, I saw in other people’s post, the value is “5a9427648b0beebeb69579cc”. But no matter what value it is, we all cannot find it’s corresponding comment in our preloaded database.
  2. The second question is regarding the test itself, the name of this test is “AddCommentUsingObjectId”, so I assume it is supposed to be a write operation, but when I look into the code all I can see the code eventually be invoked is commentCollection.find(new Document("_id", obj_id)).first(); which is purely a read operation has nothing to do with any insert, update or replace. Can anyone from MongoDB tell us what is the purpose of this test, and how should we finished this test ?

Hi @Kushagra_Kesav can you take a look on this question, really appreciate.

Hi @Junlei_Li,

Thanks for reaching out to us!

Let me cross-check and get back to you!

Thanks,
Kushagra

1 Like

Hi @Junlei_Li,

I cross-checked and found that their is no any documents with the given _id: ObjectId("619e483309f8c99feb5c87a2") in our sample dataset. And I understand your concern!

Also, there is no requirement to run this particular test! You can skip this one! Although you have completed your M220J course with a 100% score. :tada: Congratulation on this!

However, I will pass this feedback to our Curriculum engineers to look into this!

Thanks,
Kushagra

1 Like