Skip to content

Commit

Permalink
new presentation: node-and-mongodb
Browse files Browse the repository at this point in the history
  • Loading branch information
marko-knoebl committed Jan 24, 2021
1 parent c1cc05a commit 1c3a005
Show file tree
Hide file tree
Showing 69 changed files with 36,902 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ node_modules
__pycache__
.pytest_cache
resources_unversioned
.env
61 changes: 61 additions & 0 deletions dist/databases-de-document.html
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,51 @@ <h2>ids</h2>
<h2>BSON Dateiformat</h2>
<p>MongoDB basiert auf dem BSON Dateiformat. Dieses ähnelt JSON, ist aber ein binäres Format und lässt sich effizienter lesen und schreiben.</p>
<p>Der Export bzw Import geschieht mittels der Programme <code>mongodump</code> und <code>mongorestore</code></p>
<h1>MongoDB Atlas</h1>
<h2>MongoDB Atlas</h2>
<p><a href="https://www.mongodb.com/cloud/atlas">Atlas</a>: gehostete MongoDB-Datenbanken von den Entwicklern von MongoDB (Login via Google möglich)</p>
<h2>Atlas cluster setup</h2>
<ul>
<li>erstelle eine neue Organisation</li>
<li>erstelle ein neues Projekt (mit Mitgliedern)</li>
<li>erstelle ein "shared cluster"
<ul>
<li>wähle einen beliebigen Cloud-Provider (<em>AWS</em>, <em>Google</em> oder <em>Azure</em>)</li>
</ul>
</li>
</ul>
<h2>Atlas dataset setup</h2>
<ul>
<li>klicke auf den Clusternamen, für die Detailansicht</li>
<li>Klicke auf den Tab <em>Collections</em></li>
<li>Wähle "Load a Sample Dataset" - erstellt 8 Beispieldatenbanken</li>
</ul>
<h2>Atlas web interface</h2>
<p>versuche:</p>
<ul>
<li>Erstellen einer weiteren Datenbank</li>
<li>Erstellen weiterer Collections</li>
<li>create / update / delete mehrerer Records / Dokumente</li>
</ul>
<h1>MongoDB Shell</h1>
<h2>MongoDB Shell</h2>
<p><strong>MongoDB Shell</strong> = einfaches Befehlszeileninterface für MongoDB</p>
<p>online ausprobieren:</p>
<p><a href="https://docs.mongodb.com/manual/tutorial/getting-started/">https://docs.mongodb.com/manual/tutorial/getting-started/</a></p>
<p>eine Untermenge der MongoDB shell in reinem JavaScript verwenden (ohne Installation von MongoDB):</p>
<p><a href="https://github.com/marko-knoebl/mingodb">https://github.com/marko-knoebl/mingodb</a></p>
<h2>Befehle</h2>
<p>wichtige Befehle:</p>
<ul>
<li><code>.insertOne</code></li>
<li><code>.insertMany</code></li>
<li><code>.find</code></li>
<li><code>.findOne</code></li>
<li><code>.updateOne</code></li>
<li><code>.replaceOne</code></li>
<li><code>.deleteOne</code></li>
<li><code>.deleteMany</code></li>
</ul>
<h2>Create</h2>
<p>Erstellen eines Eintrags:</p>
<pre><code class="hljs language-js">db.countries.insertOne({
Expand Down Expand Up @@ -173,6 +211,29 @@ <h2>Delete</h2>
</code></pre>
<h2>Übung</h2>
<p>Erstellen und Ändern einer Kontaktdatenbank</p>
<h1>MongoDB Shell - Details</h1>
<h2>Zählen</h2>
<pre><code class="hljs language-js">db.todos.find({ <span class="hljs-attr">completed</span>: <span class="hljs-literal">false</span> }).count();
</code></pre>
<h2>Query selectors</h2>
<ul>
<li><code>$text</code></li>
<li><code>$regex</code></li>
<li><code>$gt</code>, <code>$gte</code>, <code>$lt</code>, <code>$lte</code></li>
<li><code>$in</code></li>
</ul>
<h2>Query selectors</h2>
<pre><code class="hljs language-js">db.products.find({ <span class="hljs-attr">name</span>: { <span class="hljs-attr">$text</span>: <span class="hljs-string">'fairphone'</span> } });
db.products.find({
<span class="hljs-attr">category</span>: <span class="hljs-string">'phone'</span>,
<span class="hljs-attr">price</span>: { <span class="hljs-attr">$lt</span>: <span class="hljs-number">300</span> },
});
db.products.find({
<span class="hljs-attr">category</span>: { <span class="hljs-attr">$in</span>: [<span class="hljs-string">'laptop'</span>, <span class="hljs-string">'tablet'</span>] },
<span class="hljs-attr">price</span>: { <span class="hljs-attr">$lt</span>: <span class="hljs-number">400</span> },
});
</code></pre>
<p>siehe: <a href="https://docs.mongodb.com/manual/reference/operator/query/">https://docs.mongodb.com/manual/reference/operator/query/</a></p>
<h1>SQL Grundlagen</h1>
<h2>SQL</h2>
<p>SQL = Structured Query Language</p>
Expand Down
61 changes: 61 additions & 0 deletions dist/databases-de.html
Original file line number Diff line number Diff line change
Expand Up @@ -2180,13 +2180,51 @@
</section><section class="slide"><h2>BSON Dateiformat</h2>
<p>MongoDB basiert auf dem BSON Dateiformat. Dieses ähnelt JSON, ist aber ein binäres Format und lässt sich effizienter lesen und schreiben.</p>
<p>Der Export bzw Import geschieht mittels der Programme <code>mongodump</code> und <code>mongorestore</code></p>
</section></section><section class="slides-section"><section class="slide"><h1>MongoDB Atlas</h1>
</section><section class="slide"><h2>MongoDB Atlas</h2>
<p><a href="https://www.mongodb.com/cloud/atlas">Atlas</a>: gehostete MongoDB-Datenbanken von den Entwicklern von MongoDB (Login via Google möglich)</p>
</section><section class="slide"><h2>Atlas cluster setup</h2>
<ul>
<li>erstelle eine neue Organisation</li>
<li>erstelle ein neues Projekt (mit Mitgliedern)</li>
<li>erstelle ein "shared cluster"
<ul>
<li>wähle einen beliebigen Cloud-Provider (<em>AWS</em>, <em>Google</em> oder <em>Azure</em>)</li>
</ul>
</li>
</ul>
</section><section class="slide"><h2>Atlas dataset setup</h2>
<ul>
<li>klicke auf den Clusternamen, für die Detailansicht</li>
<li>Klicke auf den Tab <em>Collections</em></li>
<li>Wähle "Load a Sample Dataset" - erstellt 8 Beispieldatenbanken</li>
</ul>
</section><section class="slide"><h2>Atlas web interface</h2>
<p>versuche:</p>
<ul>
<li>Erstellen einer weiteren Datenbank</li>
<li>Erstellen weiterer Collections</li>
<li>create / update / delete mehrerer Records / Dokumente</li>
</ul>
</section></section><section class="slides-section"><section class="slide"><h1>MongoDB Shell</h1>
</section><section class="slide"><h2>MongoDB Shell</h2>
<p><strong>MongoDB Shell</strong> = einfaches Befehlszeileninterface für MongoDB</p>
<p>online ausprobieren:</p>
<p><a href="https://docs.mongodb.com/manual/tutorial/getting-started/">https://docs.mongodb.com/manual/tutorial/getting-started/</a></p>
<p>eine Untermenge der MongoDB shell in reinem JavaScript verwenden (ohne Installation von MongoDB):</p>
<p><a href="https://github.com/marko-knoebl/mingodb">https://github.com/marko-knoebl/mingodb</a></p>
</section><section class="slide"><h2>Befehle</h2>
<p>wichtige Befehle:</p>
<ul>
<li><code>.insertOne</code></li>
<li><code>.insertMany</code></li>
<li><code>.find</code></li>
<li><code>.findOne</code></li>
<li><code>.updateOne</code></li>
<li><code>.replaceOne</code></li>
<li><code>.deleteOne</code></li>
<li><code>.deleteMany</code></li>
</ul>
</section><section class="slide"><h2>Create</h2>
<p>Erstellen eines Eintrags:</p>
<pre><code class="hljs language-js">db.countries.insertOne({
Expand Down Expand Up @@ -2235,6 +2273,29 @@
</code></pre>
</section><section class="slide"><h2>Übung</h2>
<p>Erstellen und Ändern einer Kontaktdatenbank</p>
</section></section><section class="slides-section"><section class="slide"><h1>MongoDB Shell - Details</h1>
</section><section class="slide"><h2>Zählen</h2>
<pre><code class="hljs language-js">db.todos.find({ <span class="hljs-attr">completed</span>: <span class="hljs-literal">false</span> }).count();
</code></pre>
</section><section class="slide"><h2>Query selectors</h2>
<ul>
<li><code>$text</code></li>
<li><code>$regex</code></li>
<li><code>$gt</code>, <code>$gte</code>, <code>$lt</code>, <code>$lte</code></li>
<li><code>$in</code></li>
</ul>
</section><section class="slide"><h2>Query selectors</h2>
<pre><code class="hljs language-js">db.products.find({ <span class="hljs-attr">name</span>: { <span class="hljs-attr">$text</span>: <span class="hljs-string">'fairphone'</span> } });
db.products.find({
<span class="hljs-attr">category</span>: <span class="hljs-string">'phone'</span>,
<span class="hljs-attr">price</span>: { <span class="hljs-attr">$lt</span>: <span class="hljs-number">300</span> },
});
db.products.find({
<span class="hljs-attr">category</span>: { <span class="hljs-attr">$in</span>: [<span class="hljs-string">'laptop'</span>, <span class="hljs-string">'tablet'</span>] },
<span class="hljs-attr">price</span>: { <span class="hljs-attr">$lt</span>: <span class="hljs-number">400</span> },
});
</code></pre>
<p>siehe: <a href="https://docs.mongodb.com/manual/reference/operator/query/">https://docs.mongodb.com/manual/reference/operator/query/</a></p>
</section></section><section class="slides-section"><section class="slide"><h1>SQL Grundlagen</h1>
</section><section class="slide"><h2>SQL</h2>
<p>SQL = Structured Query Language</p>
Expand Down
71 changes: 71 additions & 0 deletions dist/databases-de.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,33 @@ MongoDB basiert auf dem BSON Dateiformat. Dieses ähnelt JSON, ist aber ein bin

Der Export bzw Import geschieht mittels der Programme `mongodump` und `mongorestore`

# MongoDB Atlas

## MongoDB Atlas

[Atlas](https://www.mongodb.com/cloud/atlas): gehostete MongoDB-Datenbanken von den Entwicklern von MongoDB (Login via Google möglich)

## Atlas cluster setup

- erstelle eine neue Organisation
- erstelle ein neues Projekt (mit Mitgliedern)
- erstelle ein "shared cluster"
- wähle einen beliebigen Cloud-Provider (_AWS_, _Google_ oder _Azure_)

## Atlas dataset setup

- klicke auf den Clusternamen, für die Detailansicht
- Klicke auf den Tab _Collections_
- Wähle "Load a Sample Dataset" - erstellt 8 Beispieldatenbanken

## Atlas web interface

versuche:

- Erstellen einer weiteren Datenbank
- Erstellen weiterer Collections
- create / update / delete mehrerer Records / Dokumente

# MongoDB Shell

## MongoDB Shell
Expand All @@ -181,6 +208,19 @@ eine Untermenge der MongoDB shell in reinem JavaScript verwenden (ohne Installat

<https://github.com/marko-knoebl/mingodb>

## Befehle

wichtige Befehle:

- `.insertOne`
- `.insertMany`
- `.find`
- `.findOne`
- `.updateOne`
- `.replaceOne`
- `.deleteOne`
- `.deleteMany`

## Create

Erstellen eines Eintrags:
Expand Down Expand Up @@ -265,6 +305,37 @@ db.countries.deleteMany({});

Erstellen und Ändern einer Kontaktdatenbank

# MongoDB Shell - Details

## Zählen

```js
db.todos.find({ completed: false }).count();
```

## Query selectors

- `$text`
- `$regex`
- `$gt`, `$gte`, `$lt`, `$lte`
- `$in`

## Query selectors

```js
db.products.find({ name: { $text: 'fairphone' } });
db.products.find({
category: 'phone',
price: { $lt: 300 },
});
db.products.find({
category: { $in: ['laptop', 'tablet'] },
price: { $lt: 400 },
});
```

siehe: <https://docs.mongodb.com/manual/reference/operator/query/>

# SQL Grundlagen

## SQL
Expand Down
85 changes: 85 additions & 0 deletions dist/databases-en-document.html
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,75 @@ <h2>ids</h2>
<h2>BSON file format</h2>
<p>MongoDB is based on the BSON file format. It resembles JSON, but it is a binary format and can be read and written more efficiently</p>
<p>Importing and exporting can be done via the programs <code>mongodump</code> and <code>mongorestore</code></p>
<h1>MongoDB Atlas</h1>
<h2>MongoDB Atlas</h2>
<p><a href="https://www.mongodb.com/cloud/atlas">Atlas</a>: hosted MongoDB databases provided by the developers of MongoDB (Login via Google supported)</p>
<h2>Atlas organization</h2>
<ul>
<li>organization
<ul>
<li>project
<ul>
<li>cluster (1 free per project)
<ul>
<li>database
<ul>
<li>collection
<ul>
<li>document</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
<h2>Atlas cluster setup</h2>
<ul>
<li>create a new organization</li>
<li>create a new project (with members)</li>
<li>create a shared cluster (free option)
<ul>
<li>choose any cloud provider (<em>AWS</em>, <em>Google</em> or <em>Azure</em>)</li>
</ul>
</li>
</ul>
<h2>Atlas dataset setup</h2>
<ul>
<li>click on the cluster name to see the details view</li>
<li>click on the <em>Collections</em> tab</li>
<li>click "Load a Sample Dataset" - creates 8 sample databases</li>
</ul>
<h2>Atlas web interface</h2>
<p>try to:</p>
<ul>
<li>create another database</li>
<li>create another collection</li>
<li>create / update / delete multiple records / documents</li>
</ul>
<h1>MongoDB shell</h1>
<h2>MongoDB shell</h2>
<p><strong>MongoDB shell</strong> = simple command line interface for MongoDB that comes with MongoDB</p>
<p>try it online:</p>
<p><a href="https://docs.mongodb.com/manual/tutorial/getting-started/">https://docs.mongodb.com/manual/tutorial/getting-started/</a></p>
<p>use a subset of MongoDB shell in pure JavaScript (without installing MongoDB):</p>
<p><a href="https://github.com/marko-knoebl/mingodb">https://github.com/marko-knoebl/mingodb</a></p>
<h2>Commands</h2>
<p>important commands:</p>
<ul>
<li><code>.insertOne</code></li>
<li><code>.insertMany</code></li>
<li><code>.find</code></li>
<li><code>.findOne</code></li>
<li><code>.updateOne</code></li>
<li><code>.replaceOne</code></li>
<li><code>.deleteOne</code></li>
<li><code>.deleteMany</code></li>
</ul>
<h2>Create</h2>
<p>creating entries in a collection:</p>
<pre><code class="hljs language-js">db.countries.insertOne({
Expand Down Expand Up @@ -173,6 +235,29 @@ <h2>Delete</h2>
</code></pre>
<h2>Exercise</h2>
<p>Create and modify a contact database</p>
<h1>MongoDB shell - details</h1>
<h2>Counting</h2>
<pre><code class="hljs language-js">db.todos.find({ <span class="hljs-attr">completed</span>: <span class="hljs-literal">false</span> }).count();
</code></pre>
<h2>Query selectors</h2>
<ul>
<li><code>$text</code></li>
<li><code>$regex</code></li>
<li><code>$gt</code>, <code>$gte</code>, <code>$lt</code>, <code>$lte</code></li>
<li><code>$in</code></li>
</ul>
<h2>Query selectors</h2>
<pre><code class="hljs language-js">db.products.find({ <span class="hljs-attr">name</span>: { <span class="hljs-attr">$text</span>: <span class="hljs-string">'fairphone'</span> } });
db.products.find({
<span class="hljs-attr">category</span>: <span class="hljs-string">'phone'</span>,
<span class="hljs-attr">price</span>: { <span class="hljs-attr">$lt</span>: <span class="hljs-number">300</span> },
});
db.products.find({
<span class="hljs-attr">category</span>: { <span class="hljs-attr">$in</span>: [<span class="hljs-string">'laptop'</span>, <span class="hljs-string">'tablet'</span>] },
<span class="hljs-attr">price</span>: { <span class="hljs-attr">$lt</span>: <span class="hljs-number">400</span> },
});
</code></pre>
<p>see: <a href="https://docs.mongodb.com/manual/reference/operator/query/">https://docs.mongodb.com/manual/reference/operator/query/</a></p>
<h1>SQL Basics</h1>
<h2>SQL</h2>
<p>SQL = Structured Query Language</p>
Expand Down
Loading

0 comments on commit 1c3a005

Please sign in to comment.