UsingPojoLesson test

I seem to have a problem creating actor with string id. I see that one actor creates a date_of_birth bson property with $date format. The other uses a long instead of $date. Not sure why but its making the testReadObjectWithCustomFieldCodec test fail on line 413. It’s returning a null value instead of a date.

Hi @Roger_39802,

Please share the code changes (if any you made) and the error console screen.

Kanika

Did you make any changes to the UsingPojoLesson.java file? As I am able to pass the test.

I don’t remember changing anything in the UsingPojoLesson.class. Only in the ActorBasic.java file. I added the BsonProperty annotation as described in the video.

You don’t need to modify anything in the lesson classes. They are just for your reference.

Kanika

Ok, so in the utils package I’m not suppose to add the Bsonproperty to the variables?

Hi @Roger_39802,

Thank you for following the lecture and running the lesson files! Could you please make sure that you added the BsonProperty annotation to date_of_birth, num_movies, and _id properties. In cases where the property name in the database doesn’t match the Codec property name, make sure to address that.

If it still doesn’t work, please attach a screenshot to your response, so that I can see how you added the BsonProperty annotations.

Thank you,

Yulia

The first document inserted in the database has the one difference where the date shows it’s type is long, the second document inserted(umm…natalie portman I think) shows the type Date.Capture

Capture