Quiz

  1. Probably off topic, but I was curious if all query operations use $? I had originally thought it was just for jQuery, but I see now that it is also used in the MongoDB query language. jQuery and MondoDB are separate right?? Or is it because of nodeJS that we're using the $?

    You are correct that jQuery and MongoDB are separate.

    The $ is just a coincidence. $ is just an odd letter that is allowed in JS identifiers, so it can be a nice way to have something stand out.

  2. Where is the database stored? Can we make our own local ones?

    It's stored on MongoDB's servers, in the cloud somewhere. I let them take care of all the administration and such.

  3. Why we are using MongoDB instead of MySQL

    That's one of the differences between the fall version of 304, which uses MySQL, and the spring version, which using MongoDB. Both are important players, so rather than pick one, I wanted to allow a choice.

  4. I’d like to talk more about the MQL syntax.

    Sure. It's literally a whole new language, built of expressions using JS dictionaries (documents).

    
        db.collection('people').find({nm: 123}).toArray();
        db.collection('people').find({nm: {$lt: 12}}).toArray();
        db.collection('people').find({name: /George/}).toArray();
    
    
  5. I feel like the content from the reading today is very dense, and it would be nice if we can unpack it more together during class.

    Yes, it certainly is. We'll start playing with the Mongo Shell very soon.

  6. can we go over projection? not sure I understand what it is used for

    Projection is jargon for reducing the amount of data, but choosing or discarding attributes (keys) from the documents.

    
    db.collection.find({}, {projection: {_id: 0, title: 1, tt: 1}});
    db.collection.find({nm: 123}).project({name: 1});  // just want his name
    
    
  7. When would we search with projection vs regex/ what is the difference?

    Projection isn't a way to search. It just a way to reduce the data.

    Regex is a great way to search for strings. That's what regular expressions are for.

  8. How we might use nested arrays and their limitations. For example, the reading demonstrated using a nested array to search for movies with a cast of size three. Can you use a nested array to search for a movie with a cast of size three which also includes George Clooney? Or would this get too messy with a nested array?

    We could certainly do queries like that. Yes, they can get complicated, but the more work we can do in the cloud, the better.

  9. Do examples (would a Jupyter notebook be possible?) of ways to match strings/sort/etc!

    We'll play in the Mongo Shell today.

  10. How will the returned result look like when we find the elements by their keys if there are multiples that satisfy the conditions?

    By default, all documents are returned with keys. If your search returns several matches, you can tell them apart with their keys. For example, all the Georges:

    
        db.collection('people').find({name: /George/}).toArray();
    
    
  11. The argument that find and findOne takes in. Also their returns.

    Their argument is a document (JS object literal) containing the query. Again, that's a whole new language, and one that will take a little time to learn. Documentation is our friend.

  12. regular expressions / Regex; E.g. expand more on ^ and $. / why do we want to use regular expressions when searching strings?

    Regular expressions are a way to describe a pattern for a string. For example, a phone number might look like DDD-DDD-DDDD. Regular expressions allow us to search for things like that.

  13. Overall, I feel like I just need more time and practice to digest the reading materials. I'm also confused about what escaping from a metacharacter means?

    A meta-character comes from the regex world. It's a character that is used to talk about other characters. Like [0-9] is a way of describing a digit.

  14. things were pretty clear for me!

    Amazing!