Quiz

  1. I am a little confused about the relationship between the $set operator and updateOne() method. Is the $set operator a way to format a parameter to be passed into updateOne() to update the document? Does this mean the $set operator cannot be used on its own?

    Great question! Yes, the two work together. updateOne() (and updateMany) are methods that will modify (update) document(s) in the collection.

    The $set operator tells how to modify the document. Other operators might be $inc or $min or even $push onto an array.

    You can't sprinkle a $set into a .find() method to set a field in a document you've found.

  2. I want to know the difference between using single quotation marks ' ' , double quotation marks "" "", and these ` ` backslash quotation marks. Wondering if it makes a difference when using them.

    Single and double quotes are interchangeable.

    backquotes (or backticks) are template literals. They are a lot like f-strings in Python: you can put variable values into them:

    
    let fav1 = 'raindrops on roses';    
    let fav2 = "whiskers on kittens";    
    let myp = `

    Two of my favorite things are ${fav1} and ${fav2}

    `;
  3. The aggregation pipeline / I hope to practice using aggregation pipelines. / Could we talk more about the aggregation pipeline? / can we go over another aggregation pipeline example?

    All good questions. The aggregation pipeline is powerful but complicated. In this class, you should try to do computations in the database whenever possible. If it's not obvious, consult with me and we can try to figure it out together. If we can't, we'll compute in JavaScript.

  4. Mostly understand besides aggregation pipeline. / This reading was very clear to me.