diff --git a/cheat_sheets/MongoDB.html b/cheat_sheets/MongoDB.html index 4c2b60f..9631b98 100644 --- a/cheat_sheets/MongoDB.html +++ b/cheat_sheets/MongoDB.html @@ -38,6 +38,9 @@
aggregate: summarize the data in a certain way.
+SYNTAX: collection.aggregate([list of parameters])
+each parameter maps a function, e.g, $group, to the arguments of that functions.
+Functions include: +
embedding: document containing other documents
+referencing: refer to other documents
+join: combine information from different documents
+single source of truth: all information is stored in one place only
+schema: validator for adding documents to collection
+SYNTAX: same as with querying the collection.
+You can also add the validator such that any added document is checked
+db.command("collMod", "COLLECTION", validator=SCHEMA)
+It is more common to use JSON schema, which allows for a more detailed error message.
+ +In Python, this works via "import jsonschema"
+asymptotic: approaching but never connecting with a line or a curve.
+useful because we want to know how algorithms behave when n is very large.
+the definition for function that does the work: T(n).
+we have to determine the bounds of the output of T(n) for all possible values of n.
+complexity order: +
Big-O is used for the upper-bound of T(n).
+This is for the worst case.
+ +$$ {T(n) \text{ is } O( f(n))}$$
+$$ {\text{ iff } T(n) \gt c* f(n)} $$
+$$ {\text{ for all } n>= n_{0}} $$
+ +T(n) can be upper-bounded using f(n).
+T(n) is the function that does the actual work.
+O means that we upper-bound it.
+f(n) is the function used for bounding.
+The iff explains when the function can be used for upper-bounding.
+$$ {n_{0}} $$ is when n=0.
+Lower-bound is for the best case.
+In this case, all values must be below the value of T(n).
+You want to upper-bound a function as tightly as possible.
+loose upper-bound: an upper-bound that is correct, but far away from the actual upper-bound.
+tight upper-bound: an upper-bound that is correct and is close to the actual upper-bound.
+where the upper-bound and the lower-bound come together.
+there is no little theta since theta is a perfect bound.
+ +Big O Notation is the language we use to describe the complexity of an algorithm.
+With Big O Notation, we express the runtime in terms of how quickly it grows relative to the input as the input gets larger.
+Some examples of Big O Notation:
+Scenarios: +
We say that a graph G = (V, E) is bipartite if its node set V can be partitioned into sets X and Y in such a way that every edge has one end in X and the other end in Y.
+Dynamic Programming (DP) is an algorithmic technique for solving an optimization problem by breaking it down into + simpler subproblems and utilizing the fact that the optimal solution to the overall problem depends upon the optimal + solution to its subproblems.
+definition of efficiency needs to be: +
worst case running time: bound on the largest possible running time the algorithm could have over all inputs of a given size N, and see how this scales with N.
+average-case analysis: very hard to establish "average" cases.
+search space: combinations of input.
+brute force: all results.
+analytical level: meta-level without implementation.
+proposed definition of efficiency:An algorithm is efficient if it achieves + qualitatively better worst-case performance, at an analytical level, than + brute-force search.
+proposed definition of efficiency: An algorithm is efficient if it has a polynomial running time.
+Ideally, when the input size increases by a constant factor, the algorithm should only slow down by some constant factor C.
+A greedy algorithm is any algorithm that follows the problem-solving heuristic of making the locally optimal choice at + each stage.
+a set of nodes S ⊆ V is independent if no two nodes in S are joined by an edge
+A problem that can be solved in theory (e.g. given large but finite resources, especially time), but for which in + practice any solution takes too many resources to be useful, is known as an intractable problem.
+ +The Computational Complexity is categorized into difficulty, called Computational Classes
++
Does P = NP? Are questions that are verified in polynomial time also solved in polynomial time?
+A polynomial can have constants, variables and exponents, but never division by a variable.
+ +PSPACE-complete problems are believed to be strictly harder than NP-complete problems, and this conjectured lack of short “proofs” for their solutions is one indication of this greater hardness
+Actuator: Een actuator zet informatie om in een fysiek verschijnsel
+ +Sensor: Een sensor zet een fysiek verschijnsel om in informatie
+ +Een controller is een besturingscomputer
+In een IoT-apparaat vind je vaak een microcontroller
+Verderop in een IoT-toepassing gebruik je controllers om de verschillende functionele elementen, IoT-apparaten tot + internetdiensten te verbinden, en te combineren met allerlei regels voor de besturing. Een voorbeeld hiervan is een + NodeRed-server.
+