M220P: create/update comments (ticket in Chapter 2)

Hi
I went through the forum posts re the ticket create/update comments. However, I am still stuck with this ticket… :frowning:

After hours of trying, I am on the edge of surrendering…

What ist wrong with:

"name": user.name, 
"email": user.email, 
'movie_id': ObjectId(movie_id), 
'text': comment, 
'date':date 

in the ‘add_comment’-function?

I really do not get the point.

Moreover it seems that there is a similar problem with:

        { '_id':ObjectId(comment_id), 'email': user_email },
        { '$set': { "text": text, 'date':date }}

in the ‘update_comment’ function.

Any hint is very welcome!!

Vinz

@Vinz_16012 you’ve got more fields than was instructed in the comments within the script:


It’s specifically asking you to implement only the fields listed.

I would also suggest that you edit your post to exclude the possible answers.

… and it’s also helpful to mention which Chapter it relates to :wink:

Thanks for responding. I may be blind, but I count 5 fields and I thought to have implented 5 fields (ref. edited post)?

I probably read that wrong because of the lack of formatting and lack of sleep :slight_smile: .
What you currently have looks good. Try adding a space between 'date':date to become 'date': date so that it’s consistent with the other fields; do the same for _id. And also try adding --verbose when calling the validator for info on what’s wrong.

Hi @Vinz_16012,

Please let me know if the suggestion provided by @007_jb worked for you.

Kanika

1 Like

Hi Kanika

So far, my problems are not solved yet. However I much appreciate the hints given by 007_jb. As I am not a professional programmer (however, I am using MongoDB for professional reasons), it might be something silly which a professional programmer would not do wrong…
It would be great to have a teaching assistant who could take a look at ones code in case problems like mine.
I wonder for example if my mistake could be located in the ticket before even though I was able to complete that one.
Anyway thanks for asking. I probably won’t be able to commit all tickets by tomorrow as my time budget is more or less used. I will have to retake to course…

Kind regards,

Vinz

Hi @Vinz_16012,

Sure, you are right. I was away last week, so sorry for not getting back in time. :slight_smile: I have sent you a direct message where you can share the code with me.

That won’t be able to help you with the time, but may help you for the next offering.

Kanika

Part timer :wink: :beach_umbrella:

I was out for MongoDB Conference. which was last week. :slight_smile:

1 Like

I’m having the same issue. My tests pass, but I can’t get validated. Can I share that section of my code with someone? Thanks

Have you tried adding --verbose to the validator call?
<name of validator>.py --verbose

Can’t help with that unfortunately. Only the Curriculum Engineers can.

Thanks for the reply. Here is my output when I add --verbose:

“tests/test_delete_comments.py::test_add_comment_should_be_implemented PASSED [ 33%]
tests/test_delete_comments.py::test_should_not_delete_comment_if_email_does_not_match PASSED [ 66%]
tests/test_delete_comments.py::test_delete_comment_should_delete_if_email_is_owner PASSED [100%]”

Let’s see the output for --verbose 2.

Here is the output for the second:

"tests/test_create_update_comments.py::test_add_comment PASSED [ 25%]
tests/test_create_update_comments.py::test_update_comment PASSED [ 50%]
tests/test_create_update_comments.py::test_do_not_update_comment_if_is_not_owner PASSED [ 75%]
tests/test_create_update_comments.py::test_delete_is_given PASSED "

It’s passes all round! This one is definitely for @Kanika.

By the way, do you relaunch the mflix website for every single test?

Yeah…I thought the same thing. I refreshed the page and am getting the same output. Here are my screens:

I wouldn’t worry as much if the due date wasn’t tomorrow.

Don’t worry, the Curriculum Engineers will sort it out under these circumstances.
Just so I understand, the mflix site is not generating a code?

Exactly…despite having passed tests