• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 2 out of 8 pages
Summary

Summary Notes mongodb

Document preview thumbnail
Preview 2 out of 8 pages

EDX's MongoDB course summarized with examples of how functions work.

Content preview

Mongodb compass: visual interface to mongo db
Atlas: mongo’s database as a service

Refering to a collection from database -> database.table
Documents are stored in collections, database can have more collections.

You may use any supported value type for any field value or array elment in a mongodb
document.

MongoDB provides specific support for documents, arrays, and geospatial data.

JSON documents:
- begin and end with { }
- are composed of fields: ​“key”:”value”, /​ / commas seperate the fields
- Arrays are in normal brackets:




ex. {“end station name”Broadway”}
RANGE FILTER
{'birth year': {$gte: 1985,$lt: 1990}} // $gte = greater than or equal to, $lt = less than

CRUD: create, read, update, delete

Replica sets are designed so that if the primary node goes down, one of the other nodes will
step up to take its place so that clients can continue reading and writing data as if nothing
had happened.

insertOne()
1. Select database (use video), via show collections you can see all the databases
2. ex query: db.moviesScratch.insertOne({title: "Star Trek II: The Wrath of Khan", year:
1982, imdb: "tt0084726"})

insertMany() ->
- ORDERED: as soon as an error encouters, insertMany stops inserting:
db​.​moviesScratch​.​insertMany​(
[

, {
​"_id"​ :​ ​"tt0084726"​,
​"title"​ :​ ​"Star Trek II: The Wrath of Khan"​,
​"year"​ :​ ​1982​,
​"type"​ :​ ​"movie"
},
{
​"_id"​ :​ ​"tt0796366"​,
​"title"​ :​ ​"Star Trek"​,
​"year"​ :​ ​2009​,
​"type"​ :​ ​"movie"
},
{
​"_id"​ :​ ​"tt0084726"​,
​"title"​ :​ ​"Star Trek II: The Wrath of Khan"​,
​"year"​ :​ ​1982​,
​"type"​ :​ ​"movie"
},
{
​"_id"​ :​ ​"tt1408101"​,
​"title"​ :​ ​"Star Trek Into Darkness"​,
​"year"​ :​ ​2013​,
​"type"​ :​ ​"movie"
},
{
​"_id"​ :​ ​"tt0117731"​,
​"title"​ :​ ​"Star Trek: First Contact"​,
​"year"​ :​ ​1996​,
​"type"​ :​ ​"movie"
}
],
);



- UNORDERED: continues after getting an error
db​.​moviesScratch​.​insertMany​(
[
{
​"_id"​ :​ ​"tt0084726"​,
​"title"​ :​ ​"Star Trek II: The Wrath of Khan"​,

Document information

Study
Uploaded on
December 1, 2019
Number of pages
8
Written in
2019/2020
Type
Summary
$4.60

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
Strazz
4.0
(50)
Sold
201
Followers
186
Items
8
Last sold
2 year ago



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions