fix structure

This commit is contained in:
Jannis 2025-02-19 19:54:56 +01:00
parent 3cc4ae5699
commit a7e1a41de4
31 changed files with 102 additions and 13 deletions

17
KN01/Feldmann.Jannis.json Normal file
View file

@ -0,0 +1,17 @@
[
{
"_id": {
"$oid": "67b48eca0608f20a258e2013"
},
"name": "Jannis Feldmann",
"adresse": "Giessenstrasse 12c",
"plz": 8608,
"ort": "Bubikon",
"geburtsdatum": "2000-08-15T00:00:00Z",
"email": "jannis@epilogue.team",
"hobbies": ["Programmieren", "Sport", "Musik"],
"letztesLogin": {
"$date": "2024-02-18T14:45:00.000Z"
}
}
]

Binary file not shown.

After

Width:  |  Height:  |  Size: 180 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 340 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 308 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 561 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 278 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3 MiB

51
KN01/cloud-init.yml Normal file
View file

@ -0,0 +1,51 @@
#cloud-config
users:
- name: ubuntu
sudo: ALL=(ALL) NOPASSWD:ALL
groups: users, admin
home: /home/ubuntu
shell: /bin/bash
ssh_authorized_keys:
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCPIIO8uY8oWIihDv0tCAbX6toyG1RYkaLZyfGD1L+I07K4CnwAVBSU+81vw3Yv5sN9tj2Ccve9kzEeCNMld2mDP/Tt7edkx2MCToVfVx+njqwY/XbMY9bfdRKJLhIoLavuVNLnnkSIXdtlGr3JF71hPHzBDMEo64ofPCQ8hPsGxL1u3efb12jcWcRhudKtv7Qh6cVE47Zj4xImfi6VlLqwzcKZ5oCqR/z1hLLL+/pS3eM5Qsor5wmAqNfH4+z5eE+pOkFm7a0Nkygv9jwXIqtJzFGKYDe6ciBD04pEovdvY0FTyiv2vksQOVgjtu2faG2Iv1HOG0JktCIwJ49OEgjT teacher-key
- ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIKgdN/WkRYNDPLa06pBFByEMfkT+ic8XjL+WG4VcXVtN jannisfeldmann@MacBook-Air-von-Jannis.local
ssh_pwauth: false
disable_root: false
package_update: true
packages:
- unzip
- gnupg
- curl
write_files:
- path: /home/ubuntu/mongodconfupdate.sh
content: |
sudo sed -i 's/#security:/security:\n authorization: enabled/g' /etc/mongod.conf
- path: /home/ubuntu/mongodbuser.txt
content: |
use admin;
db.createUser(
{
user: "admin",
pwd: "MyPassword.42",
roles: [
{ role: "userAdminAnyDatabase", db: "admin" },
{ role: "readWriteAnyDatabase", db: "admin" },
{ role: "root", db: "admin" }
]
}
);
runcmd:
- curl -fsSL https://pgp.mongodb.com/server-6.0.asc | sudo gpg -o /usr/share/keyrings/mongodb-server-6.0.gpg --dearmor
- echo "deb [ arch=amd64,arm64 signed-by=/usr/share/keyrings/mongodb-server-6.0.gpg ] https://repo.mongodb.org/apt/ubuntu jammy/mongodb-org/6.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-6.0.list
- sudo apt-get update -y
- sudo apt-get install -y mongodb-org
- sudo sed -i 's/127.0.0.1/0.0.0.0/g' /etc/mongod.conf
- sudo chmod +x /home/ubuntu/mongodconfupdate.sh
- sudo /home/ubuntu/mongodconfupdate.sh
- sudo systemctl enable mongod
- sudo systemctl start mongod
- sleep 10
- mongosh < /home/ubuntu/mongodbuser.txt
- sudo systemctl restart mongod

39
KN01/readme.md Normal file
View file

@ -0,0 +1,39 @@
# A: Installation
connection string:
`mongodb://admin:MyPassword.42@23.22.210.87:27017/?authSource=admin&readPreference=primary&ssl=false`
![alt text](<Screenshot 2025-02-18 at 14.39.04.png>)
`authSource=admin` gibt an, dass die Authentifizierungsdaten in der "admin" Datenbank gespeichert sind. Das ist notwendigweil der Benutzer "admin" in der admin-Datenbank erstellt wurde
mit sed kann man werde ein einer datei ersetzen
![alt text](<Screenshot 2025-02-18 at 14.41.42.png>)
# B: Erste Schritte GUI
![alt text](<Screenshot 2025-02-18 at 14.45.09.png>)
Ich müsste das datum so definieren:
"letztesLogin": {
"$date": "2024-02-18T14:45:00.000Z"
}
Dann weiss mongodb direkt, dass es ein datum ist.
Man kann es so definieren dass man direkt nacher das datum verwenden kann um z.b. Zeit auszurechen zum letzten login
![alt text](<Screenshot 2025-02-18 at 14.46.52.png>)
# C: Erste Schritte CLI
![alt text](<Screenshot 2025-02-18 at 14.51.27.png>)
![alt text](<Screenshot 2025-02-18 at 14.52.44.png>)
Tables habe ein fixes Schema. Jede spalte hat ein Datentyp und alle Zielen müssen dem Schema folgen.
Collections sind flexibel Dokumente in der gleichen Collection können unterschiedliche Felder haben