M121 Lab 1 itcount() off by 1

I have what I think to be a valid pipeline but the result I get is off by 1. Can someone take a look at my pipeline, I feel this could be an error in the collection. I don’t want to post the answer but do we have a way to show a TA what we have privately to get me back on track?

Thanks

@natac13

Hey @jaguarj

I do not think there is a way to private message. At least I have not fount it yet…
However I’m glad to help, thank you for not posting answer. :smile:

So you say off by one? So 22, or 24? And you are talking about the $match Lab right?

Just for reference to here are the list of query operators
https://docs.mongodb.com/manual/reference/operator/query/#query-and-projection-operators

Yes, I got 24. Thanks for the reply!

And can I ask what collection you are running the pipeline against? And following form?

var pipeline = [
{
  $match: { 
      “imdb.rating”: { expression },
      “genres”: { expression },
      "rated": ....,
   }
}]

The problem is the genres expression using $ne.
The $ne compares two values, which our case is comparing Crime to Horror,
which makes no sense, right?

I did a command F on the results in the shell and found “Crime” listed in one of the movie genres.

I have to say that this class is really hard, the videos provide some assistence but it could be easier with more elaborate and helpful examples using all the necessary expression operators to acheive the correct results instead of providing just the base experessions. If you want people to use mongo more, don’t throw them in the deep end to have them comb the docs for an hour for one expression.

Sorry, not trying to be a downer but I think that would help a lot of people who are new, and or experienced, use mongo more.

Hey @jaguarj
Just a small favour, could you remove the section that has the answer operator? It is against forum guidelines to post answers.

Glad you figured it out :clap:

No problem, I removed it.

1 Like