diff --git a/db/nosql/mongo/docs/tutorials.txt b/db/nosql/mongo/docs/tutorials.txt index 3c879ac05..0b281830d 100644 --- a/db/nosql/mongo/docs/tutorials.txt +++ b/db/nosql/mongo/docs/tutorials.txt @@ -1 +1,4 @@ https://www.tutorialspoint.com/mongodb/index.htm + +https://www.studytonight.com/mongodb/ + 6+8+9 parts diff --git a/db/nosql/mongo/features/3 b/db/nosql/mongo/features/3 new file mode 100644 index 000000000..7bfffafad --- /dev/null +++ b/db/nosql/mongo/features/3 @@ -0,0 +1,17 @@ +coll + .find({"field1": "v1", ...}, {f1: 1, f2: 0}) // 2-nd - projection + .pretty() + .sort({keyfield: 1/-1, ...}) + https://www.studytonight.com/mongodb/sorting-in-mongodb + skip(N).limit(M) + https://www.tutorialsteacher.com/mongodb/cursor + !!! cursor + + +operators + {$gt: 75} + { $gte: new ISODate( "2020-01-30" ), $lt: new ISODate( "2022-01-30" ) } + field: {"$exists": false} + +??? + cur = db.world.find();x=cur.next();print(x["speech"]); diff --git a/db/nosql/mongo/features/administration.txt b/db/nosql/mongo/features/administration.txt new file mode 100644 index 000000000..aa711c16b --- /dev/null +++ b/db/nosql/mongo/features/administration.txt @@ -0,0 +1,6 @@ +https://www.mongodb.com/docs/manual/reference/command/nav-administration/ + https://www.mongodb.com/docs/manual/reference/command/killOp/ + https://www.mongodb.com/docs/manual/reference/command/currentOp + +security +https://www.mongodb.com/docs/manual/reference/privilege-actions/#mongodb-authaction-inprog diff --git a/db/nosql/mongo/features/agg-joins.txt b/db/nosql/mongo/features/agg-joins.txt new file mode 100644 index 000000000..c75ec6b9e --- /dev/null +++ b/db/nosql/mongo/features/agg-joins.txt @@ -0,0 +1,37 @@ +https://www.mongodb.com/docs/manual/core/aggregation-pipeline/ + https://www.mongodb.com/docs/manual/core/aggregation-pipeline-optimization/ + +https://www.mongodb.com/docs/manual/reference/aggregation/ + +https://www.mongodb.com/docs/manual/meta/aggregation-quick-reference/ +https://www.mongodb.com/docs/manual/reference/operator/aggregation/interface/ + commands: aggregate, count, distinct, mapReduce + +https://www.mongodb.com/docs/manual/reference/operator/aggregation-pipeline/ + stages + https://www.mongodb.com/docs/manual/core/map-reduce/ + ! deprecated from 5.0 +https://www.mongodb.com/docs/manual/reference/operator/aggregation/ +https://www.mongodb.com/docs/manual/reference/aggregation-variables/ + $$ +https://www.mongodb.com/docs/manual/reference/sql-aggregation-comparison/ + +https://www.mongodb.com/docs/manual/tutorial/update-documents-with-aggregation-pipeline/ + +misc + https://www.mongodb.com/docs/manual/reference/operator/aggregation/accumulator/ + +from-java-driver + https://www.mongodb.com/docs/drivers/java/sync/current/fundamentals/aggregation/ + https://www.mongodb.com/docs/drivers/java/sync/current/fundamentals/builders/aggregates/ + +2015 +https://www.mongodb.com/blog/post/joins-and-other-aggregation-enhancements-coming-in-mongodb-3-2-part-2-of-3-worked-examples +https://www.mongodb.com/blog/post/joins-and-other-aggregation-enhancements-coming-in-mongodb-3-2-part-1-of-3-introduction + $lookup (left-outer equi-join) + $match, $project, $lookup, $group, ..., geoNear, unwind, sample, sort, skip(limit number of docs), redact, out + +books +https://www.practical-mongodb-aggregations.com/front-cover.html +mongosh +https://www.mongodb.com/docs/manual/reference/method/db.collection.aggregate diff --git a/db/nosql/mongo/features/bulk.txt b/db/nosql/mongo/features/bulk.txt new file mode 100644 index 000000000..0daf5f09c --- /dev/null +++ b/db/nosql/mongo/features/bulk.txt @@ -0,0 +1 @@ +https://www.mongodb.com/docs/manual/reference/method/js-bulk/ diff --git a/db/nosql/mongo/features/concurrency.txt b/db/nosql/mongo/features/concurrency.txt new file mode 100644 index 000000000..77f7642f1 --- /dev/null +++ b/db/nosql/mongo/features/concurrency.txt @@ -0,0 +1 @@ +https://www.mongodb.com/docs/manual/faq/concurrency/#std-label-faq-concurrency-locking diff --git a/db/nosql/mongo/features/cursors.txt b/db/nosql/mongo/features/cursors.txt new file mode 100644 index 000000000..0e84e8856 --- /dev/null +++ b/db/nosql/mongo/features/cursors.txt @@ -0,0 +1,5 @@ +mongosh +https://www.mongodb.com/docs/manual/tutorial/iterate-a-cursor/ + +from-java-driver +https://www.mongodb.com/docs/drivers/java/sync/current/fundamentals/crud/read-operations/cursor/ diff --git a/db/nosql/mongo/features/db.txt b/db/nosql/mongo/features/db.txt index b53c1bcc9..4bf3d51c0 100644 --- a/db/nosql/mongo/features/db.txt +++ b/db/nosql/mongo/features/db.txt @@ -1,4 +1,19 @@ +https://www.mongodb.com/docs/manual/reference/method/js-database/ + db + .help() + .drop() + adminCommand({}) getName() getCollectionNames() - getCollection(collectionName).find() + getCollection(collectionName) + .createCollection + https://www.studytonight.com/mongodb/collection-create-and-drop-mongodb + validation... + .dropDatabase() drop existing db + .runCommand({...}) + ({ serverStatus: 1 }).metrics.apiVersions + + +show dbs +use diff --git a/db/nosql/mongo/features/inddex.txt b/db/nosql/mongo/features/inddex.txt new file mode 100644 index 000000000..2070f1850 --- /dev/null +++ b/db/nosql/mongo/features/inddex.txt @@ -0,0 +1,8 @@ +col + .createIndex({field: val, ...}) + https://www.studytonight.com/mongodb/indexing-in-mongodb + +{: 1} + +from-java-driver + https://www.mongodb.com/docs/drivers/java/sync/current/fundamentals/builders/indexes/ diff --git a/db/nosql/mongo/features/isolation-concern.txt b/db/nosql/mongo/features/isolation-concern.txt new file mode 100644 index 000000000..7ed1adcb2 --- /dev/null +++ b/db/nosql/mongo/features/isolation-concern.txt @@ -0,0 +1,4 @@ +https://www.mongodb.com/docs/manual/core/read-preference/ +https://www.mongodb.com/docs/manual/reference/read-concern/ + http://mongodb.github.io/mongo-java-driver/4.10/apidocs/mongodb-driver-core/com/mongodb/ReadConcern.html +https://www.mongodb.com/docs/manual/reference/write-concern/ diff --git a/db/nosql/mongo/features/log.txt b/db/nosql/mongo/features/log.txt new file mode 100644 index 000000000..a2fed8cad --- /dev/null +++ b/db/nosql/mongo/features/log.txt @@ -0,0 +1 @@ +https://www.mongodb.com/docs/manual/reference/log-messages/ diff --git a/db/nosql/mongo/features/operators.txt b/db/nosql/mongo/features/operators.txt new file mode 100644 index 000000000..494e6b24b --- /dev/null +++ b/db/nosql/mongo/features/operators.txt @@ -0,0 +1,10 @@ +https://www.mongodb.com/docs/manual/core/document/ +https://www.mongodb.com/docs/manual/reference/operator/query/ +https://www.mongodb.com/docs/manual/reference/operator/update/ +https://www.mongodb.com/docs/manual/reference/operator/aggregation-pipeline/ +https://www.mongodb.com/docs/manual/reference/operator/aggregation/ + +$lt +.. +$add +$multiply diff --git a/db/nosql/mongo/features/profile-explain-plan.txt b/db/nosql/mongo/features/profile-explain-plan.txt new file mode 100644 index 000000000..bf81bc5be --- /dev/null +++ b/db/nosql/mongo/features/profile-explain-plan.txt @@ -0,0 +1,65 @@ +https://www.mongodb.com/docs/manual/core/query-plans/ +https://www.mongodb.com/docs/manual/reference/explain-results/ +https://www.mongodb.com/docs/manual/tutorial/analyze-query-plan/ + +https://www.mongodb.com/docs/manual/administration/analyzing-mongodb-performance/#locking-performance + +https://www.mongodb.com/docs/manual/tutorial/manage-the-database-profiler/ +https://www.mongodb.com/docs/manual/reference/database-profiler/ + !!! results descr !!! + https://www.mongodb.com/docs/manual/core/capped-collections/ + fixed-size for high-thouput + The database profiler writes data in the system.profile capped collection + "planCacheKey" + "planSummary" : "IXSCAN { a: 1, _id: -1 }", + ... + "locks" + ... + "ts" : ISODate("2019-01-14T23:33:01.806Z"), + "client" : "127.0.0.1", + "appName" : "MongoDB Shell", + "allUsers" : [{"user" : "someuser", "db" : "admin"}], + "user" : "someuser@admin" + https://www.mongodb.com/docs/manual/reference/system-collections/#mongodb-data--database-.system.profile + +query-shape + https://www.mongodb.com/docs/manual/reference/glossary/#std-term-query-shape + A combination of query predicate, sort, projection, and collation. + query-hash + https://www.mongodb.com/docs/manual/release-notes/4.2/#std-label-4.2-query-hash +planCache + https://www.mongodb.com/docs/manual/reference/operator/aggregation/planCacheStats/ + +options +https://www.mongodb.com/docs/manual/reference/configuration-options/#mongodb-setting-operationProfiling.slowOpThresholdMs + slow-op-log + https://www.mongodb.com/docs/manual/reference/configuration-options/#operationprofiling-options + +https://www.mongodb.com/docs/manual/reference/method/db.getProfilingStatus + db.getProfilingStatus() +https://www.mongodb.com/docs/manual/reference/method/db.setProfilingLevel/ + (0) - disable + +sample + COLSCAN-bad, IXSCAN-good +https://www.mongodb.com/docs/manual/reference/method/db.collection.explain + db.runCommand({explain: { 'find' : 'collection', 'filter' : { 'brandId' : { '$eq' : 'BRND' } }, 'skip' : 0, 'limit' : 0, 'maxTimeMS' : 60000 }}) + db.collection.find({"brandId":{"$eq": "BRND"}}).explain() + db.collection.explain().find().help() + .find(...).explain("executionStats") + https://www.mongodb.com/docs/manual/tutorial/analyze-query-plan/ + +!!! +You can use $comment to add data to the query predicate to make it easier to analyze data from the profiler. +https://www.mongodb.com/docs/manual/reference/operator/query/comment/#mongodb-query-op.-comment + db.setProfilingLevel(2, 0) + db.collection.find( { , $comment: } ) + then -> "comment": "val" + +! query plan cache commands +https://www.mongodb.com/docs/manual/reference/command/nav-plan-cache/ +!!! cursor.hint +https://www.mongodb.com/docs/manual/reference/method/cursor.hint/#mongodb-method-cursor.hint + +from-java-driver +https://www.mongodb.com/docs/drivers/java/sync/current/fundamentals/crud/read-operations/cursor/ diff --git a/db/nosql/mongo/features/ref-modelling.txt b/db/nosql/mongo/features/ref-modelling.txt new file mode 100644 index 000000000..fe58e5c7f --- /dev/null +++ b/db/nosql/mongo/features/ref-modelling.txt @@ -0,0 +1,11 @@ +https://www.mongodb.com/docs/manual/tutorial/model-embedded-one-to-one-relationships-between-documents/ +https://www.mongodb.com/docs/manual/tutorial/model-embedded-one-to-many-relationships-between-documents/ +https://www.mongodb.com/docs/manual/tutorial/model-referenced-one-to-many-relationships-between-documents/ +tree structures + https://www.mongodb.com/docs/manual/tutorial/model-tree-structures-with-parent-references/ + https://www.mongodb.com/docs/manual/reference/operator/aggregation/graphLookup/#mongodb-pipeline-pipe.-graphLookup + ... + https://www.mongodb.com/docs/manual/tutorial/model-tree-structures-with-nested-sets/ + +https://www.mongodb.com/docs/manual/reference/database-references/ + DBRef diff --git a/db/nosql/mongo/features/schema-validation.txt b/db/nosql/mongo/features/schema-validation.txt new file mode 100644 index 000000000..1aa3639a1 --- /dev/null +++ b/db/nosql/mongo/features/schema-validation.txt @@ -0,0 +1 @@ +https://www.mongodb.com/docs/manual/core/schema-validation/ diff --git a/db/nosql/mongo/features/search.txt b/db/nosql/mongo/features/search.txt new file mode 100644 index 000000000..7bfffafad --- /dev/null +++ b/db/nosql/mongo/features/search.txt @@ -0,0 +1,17 @@ +coll + .find({"field1": "v1", ...}, {f1: 1, f2: 0}) // 2-nd - projection + .pretty() + .sort({keyfield: 1/-1, ...}) + https://www.studytonight.com/mongodb/sorting-in-mongodb + skip(N).limit(M) + https://www.tutorialsteacher.com/mongodb/cursor + !!! cursor + + +operators + {$gt: 75} + { $gte: new ISODate( "2020-01-30" ), $lt: new ISODate( "2022-01-30" ) } + field: {"$exists": false} + +??? + cur = db.world.find();x=cur.next();print(x["speech"]); diff --git a/db/nosql/mongo/features/transactions.txt b/db/nosql/mongo/features/transactions.txt new file mode 100644 index 000000000..0eb98d27a --- /dev/null +++ b/db/nosql/mongo/features/transactions.txt @@ -0,0 +1 @@ +https://www.mongodb.com/docs/manual/core/transactions/ diff --git a/db/nosql/mongo/features/update.txt b/db/nosql/mongo/features/update.txt index 26114451d..60c010351 100644 --- a/db/nosql/mongo/features/update.txt +++ b/db/nosql/mongo/features/update.txt @@ -1,2 +1,25 @@ +https://www.mongodb.com/docs/manual/tutorial/update-documents-with-aggregation-pipeline/ +https://www.mongodb.com/docs/manual/reference/command/nav-crud/ + +coll + .insertOne({...}) + .insertMany([...]) + .update, + .updateOne({"field": "...", ...}, [agg-pipeline]) + https://www.mongodb.com/docs/manual/tutorial/update-documents-with-aggregation-pipeline/ + $set: {"otherField": "otherVal"} + .updateMany + .replaceOne + .queryAndWrite(...) + .deleteOne + .deleteMany + .remove({filer}) + +from-java-driver + https://www.mongodb.com/docs/drivers/java/sync/current/fundamentals/builders/updates/ + 2022 https://www.fosslinux.com/49919/update-existing-documents-mongodb.htm + +bulk +https://www.mongodb.com/docs/drivers/java/sync/current/fundamentals/crud/write-operations/bulk/ diff --git a/db/nosql/mongo/java.txt b/db/nosql/mongo/java.txt new file mode 100644 index 000000000..1bd33d191 --- /dev/null +++ b/db/nosql/mongo/java.txt @@ -0,0 +1,67 @@ +https://www.mongodb.com/docs/drivers/java/sync/current/ + https://www.mongodb.com/docs/drivers/reactive-streams/ + +https://mongodb.github.io/mongo-java-driver/ + https://mongodb.github.io/mongo-java-driver/4.10/ + https://mongodb.github.io/mongo-java-driver/4.10/apidocs/ + + +https://central.sonatype.com/artifact/org.mongodb/mongodb-driver-sync +https://github.com/mongodb/mongo-java-driver + +https://www.mongodb.com/docs/drivers/java/sync/current/quick-start/ +https://www.mongodb.com/docs/drivers/java/sync/current/quick-reference/ + bulks, cursors +https://www.mongodb.com/docs/drivers/java/sync/current/usage-examples/ +https://www.mongodb.com/docs/drivers/java/sync/current/fundamentals/ +https://www.mongodb.com/docs/drivers/java/sync/current/fundamentals/connection/ +https://www.mongodb.com/docs/drivers/java/sync/current/fundamentals/databases-collections/ +https://www.mongodb.com/docs/drivers/java/sync/current/fundamentals/data-formats/ + https://www.mongodb.com/docs/drivers/java/sync/current/fundamentals/data-formats/document-data-format-extended-json/ + https://www.mongodb.com/docs/drivers/java/sync/current/fundamentals/data-formats/documents/ + +https://www.mongodb.com/docs/manual/reference/connection-string/ + +https://www.mongodb.com/docs/drivers/java/sync/current/fundamentals/connection/ +https://www.mongodb.com/docs/drivers/java/sync/current/fundamentals/stable-api/ + db.runCommand( { serverStatus: 1 } ).metrics.apiVersions + client = new MongoClient(uri, { serverApi: { version: '1', strict: true } }); + +https://www.mongodb.com/docs/drivers/java/sync/current/fundamentals/crud/ +https://www.mongodb.com/docs/drivers/java/sync/current/fundamentals/crud/read-operations/ +https://www.mongodb.com/docs/drivers/java/sync/current/fundamentals/crud/read-operations/retrieve/ +https://www.mongodb.com/docs/drivers/java/sync/current/fundamentals/crud/read-operations/cursor/ +... +https://www.mongodb.com/docs/drivers/java/sync/current/fundamentals/crud/query-document/ + +https://www.mongodb.com/docs/drivers/java/sync/current/fundamentals/aggregation/ + https://www.mongodb.com/docs/drivers/java/sync/current/fundamentals/builders/aggregates/ + +https://www.mongodb.com/docs/drivers/java/sync/current/fundamentals/builders/ + https://www.mongodb.com/docs/drivers/java/sync/current/fundamentals/builders/filters/ + https://www.mongodb.com/docs/drivers/java/sync/current/fundamentals/builders/projections/ + https://www.mongodb.com/docs/drivers/java/sync/current/fundamentals/builders/sort/ + https://www.mongodb.com/docs/drivers/java/sync/current/fundamentals/builders/updates/ + https://www.mongodb.com/docs/drivers/java/sync/current/fundamentals/builders/aggregates/ + https://www.mongodb.com/docs/drivers/java/sync/current/fundamentals/builders/indexes/ + +plan-explain +https://www.mongodb.com/docs/drivers/java/sync/current/fundamentals/crud/read-operations/cursor/ + https://www.mongodb.com/docs/manual/core/query-plans/ + https://www.mongodb.com/docs/manual/reference/explain-results/ + +pojo-cust-n +https://www.mongodb.com/docs/drivers/java/sync/current/fundamentals/data-formats/pojo-customization/ + +samples +https://www.digitalocean.com/community/tutorials/mongodb-bulk-insert-insertmany +https://www.digitalocean.com/community/tutorials/mongodb-tutorial + +api +http://mongodb.github.io/mongo-java-driver/4.10/apidocs/mongodb-driver-core/com/mongodb/ReadConcern.html + +2015 +https://www.studytonight.com/mongodb/java-integration +https://www.studytonight.com/mongodb/data-insertion-mongodb +https://www.studytonight.com/mongodb/data-updation-mongodb +https://www.studytonight.com/mongodb/retrieve-delete-mongodb diff --git a/db/nosql/mongo/tools/compass.txt b/db/nosql/mongo/tools/compass.txt index a6ad23a10..142d0db9e 100644 --- a/db/nosql/mongo/tools/compass.txt +++ b/db/nosql/mongo/tools/compass.txt @@ -1,5 +1,8 @@ -https://www.mongodb.com/try/download/compass +https://www.mongodb.com/docs/compass/current/ https://www.mongodb.com/docs/compass/current/install/ +https://www.mongodb.com/docs/compass/current/query/queries + +https://www.mongodb.com/try/download/compass MongoDB Command Line Database Tools Download available as well diff --git a/db/nosql/mongo/tools/mongosh.txt b/db/nosql/mongo/tools/mongosh.txt index c9bb8a075..f6cb1b91b 100644 --- a/db/nosql/mongo/tools/mongosh.txt +++ b/db/nosql/mongo/tools/mongosh.txt @@ -5,3 +5,5 @@ https://github.com/mongodb-js/mongosh sudo apt-get install mongodb-mongosh mongodb://:@localhost:27017/test + +https://www.mongodb.com/docs/manual/reference/method/ diff --git a/db/nosql/mongo/vscode.txt b/db/nosql/mongo/vscode.txt new file mode 100644 index 000000000..1161a06ac --- /dev/null +++ b/db/nosql/mongo/vscode.txt @@ -0,0 +1 @@ +https://code.visualstudio.com/docs/azure/mongodb