MongoDB? SQL ?? ???? ??? ??????? ???? ??? ??????
Dec 17, 2023 pm 10:58 PM???? ????? ?? ????? ??? ??????? ???? ?? ???? ??? ?? ?????. ??????? ??? ? ???? ????? ??? ??????? ???? ???????? ? ?? ?? ??? ?????. MongoDB? SQL? ? ? ?? ??? ??????? ?????. ? ????? ?? ?? ??? ??? ???? ??? ??????? ???? ??? ?? ? ?? ??? ?????.
MongoDB? SQL? ??
- ??? ??
MongoDB? BSON(Binary JSON) ??? ???? ???? ???? ?? ?????????. ???? ???? ??? ?????. ? ??? ?-? ? ?? ?-??-? ??? ?????. MongoDB? ?? ??? ??? ???????? ?? ??? ??? ???? ??? ???? ??? ????? ??? ? ?? ??? ??? ???? ?? ?????.
SQL? ???? ???? ???? ???? ??? ?????????. ? ????? ? ??? ???? ??? ? ??? ??? ?? ????. SQL??? ???? ??? ? ??? ??? ??? ????? ???? ??, ??? ????? ????? ???? ???? ??.
- ?? ??
MongoDB? ?? ??? ?? SQL ??? ?? ????. MongoDB? JavaScript? ??? ??? ?? "?? ???"??? ??? ???? "?? ??"?? JSON ??? ?? ?? ?????. MongoDB? ?? ??? ?? ???? ??? ??? ?? ? ?? ??? ???? ???? ???? ??? ? ????.
SQL? ??? ?? ??? ???? SQL ?? ?? ???? ??? ?????. SQL? ?? ??? ?? ??? ?? ??? ???? ? ???? COUNT, GROUP BY ? HAVING? ?? ?? ?? ?? ?????.
??? ??? ?????.
MongoDB ??:
db.users.find({ age: { $lt: 30 } })
SQL ??:
SELECT * FROM users WHERE age < 30;
- ??? ???
MongoDB? "?? ???" ?????????. ?, ???? ?? ???? ?? ?? ??? ?? ?? ???? ???? ? ??? ?? ? ????. ?? ??? ?? ???? ?????. ?? ?? ?? ??? ???? ?? ??? ???? ? ?? ?? ??? ???? ?? ??? ???? ? ????.
SQL? ??? ???? ?? ?????????. ? ????? ?? ?? ???? ??? ?????? ???? ??, ????? ??? ?????? ??? ??? ?????.
- Scalability
MongoDB? ??? ???? ?? ??? ?????. MongoDB??? ???? ?? ???? ?? ? ?? ??? ???? ???? ???? ???? ????? ??? ??? ??? ? ?? ??? ???? ???? ?? ??? ??? ? ????.
SQL ??????? ????? ???-???? ??? ???? ???? ?????. Master-Slave ??? ???? ??? ??? ?? ??(??, ????, ??)? ????, ???? ??? ?? ?? ??(??)? ?????. ??? ??? ??? ? ?? ?? ? ??? ??? ???? ??? ???? ?????.
??? ??????? ???? ??? ??????
??? ??????? ???? ?? ?????? ????? ?? ??? ?? ????. MongoDB ?? SQL? ???? ?? ??????? ??? ??? ??, ??? ??? ?? ? ?? ?? ??? ??? ? ?? ??? ???? ???.
- ??? ??
MongoDB? SQL? ?? ??? ?? ????. ??? ?? ? ??? ??? ??? ????? ?? ? ??????? ???? ??? ?? ??? ??????. ?? ??? ??? ??? ?? SQL ??????? ??? ? ????. ???? ????? ?? ??? ????? ????? MongoDB? ???? ???.
- ?????? ??
?? ?? ??? ??????? ?? ??? ??????? ??? ? ??? ?????. ??????? ??? ? ??????? ?? ? ?? ??? ??? ????, ??? ???, ???? ?? ?? ???? ?????.
- Scalability
??????? ? ?? ???? ????? ?? ? ???? ? ?? ??? ? ?? ??????? ???? ???.
????? ??? ??? ?????? ??? ? ? ??? ? ??? MongoDB? SQL? ?? ??? ?? ??? ??? ??? ??????? ????.
MongoDB?? ??:
const MongoClient = require('mongodb').MongoClient; const assert = require('assert'); const url = 'mongodb://localhost:27017'; const dbName = 'myproject'; const client = new MongoClient(url); client.connect(function(err) { assert.equal(null, err); console.log("Connected successfully to server"); const db = client.db(dbName); const collection = db.collection('documents'); const insertDocuments = function(callback) { const collection = db.collection('documents'); collection.insertMany([ {a : 1}, {a : 2}, {a : 3} ], function(err, result) { assert.equal(err, null); assert.equal(3, result.result.n); assert.equal(3, result.ops.length); console.log("Inserted 3 documents into the collection"); callback(result); }); } const findDocuments = function(callback) { const collection = db.collection('documents'); collection.find({}).toArray(function(err, docs) { assert.equal(err, null); console.log("Found the following records"); console.log(docs) callback(docs); }); } insertDocuments(function() { findDocuments(function() { client.close(); }); }); });
SQL? ??:
const mysql = require('mysql'); const connection = mysql.createConnection({ host: 'localhost', user: 'root', password: 'password', database: 'mydb' }); connection.connect(); connection.query('INSERT INTO mytable (id, name) VALUES (1, "foo")', function (error, results, fields) { if (error) throw error; console.log('The solution is: ', results[0].solution); }); connection.end();
??
??? ?? ??? ? ???????? ??? ??, ??? ??? ??, ?? ?? ??, ??? ??? ? ???? ? ?? ??? ????. ? ????? MongoDB? SQL? ???? ???? ??? ?????? ??? ???? ? ??? ?? ? ?? ??? ?? ??? ?????. ????? ???? ??????? ??????? ?? ??? ??? ?? ????.
? ??? MongoDB? SQL ?? ???? ??? ??????? ???? ??? ??????? ?? ?????. ??? ??? PHP ??? ????? ?? ?? ??? ?????!

? AI ??

Undress AI Tool
??? ???? ??

Undresser.AI Undress
???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover
???? ?? ???? ??? AI ?????.

Clothoff.io
AI ? ???

Video Face Swap
??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

?? ??

??? ??

???++7.3.1
???? ?? ?? ?? ???

SublimeText3 ??? ??
??? ??, ???? ?? ????.

???? 13.0.1 ???
??? PHP ?? ?? ??

???? CS6
??? ? ?? ??

SublimeText3 Mac ??
? ??? ?? ?? ?????(SublimeText3)

?? ?? ??? SQL ?? ????? ??? ???? ?? ??? ???? ?????? ??? ?????? ??? ? ????. 1. ??? ? ????? ?? ?? ??? ??? ?? ?? ?? ??? ??? ?? SQL ?? ??????. 2. ???? ?? ??? ??? ?? ??? ???? ?? ??? ??????. 3. ?????? ??? ?????? ?? ?? ??? ?? ???? ?????.

SQL ??? ???? ???? ? ?? ??? ????. 1. MySQL ?? ? ??? ?? DBMS ?? ??? ??????. 2. Sqllint? ?? ?? SQL ?? ?? ??? ??????. 3. Intellijidea ?? VisualStudiocode? ?? IDE? ??????. 4. ??? ?? ?? ????? ??????.

Navicat? "??? ????"??? ????? ?? ??? ??? ? ????. 1. Navicat ??? ???? ??????. 2. ??? ???? ???? ????? ? ? ????. 3. ?? ?? ??? ?? ?? ? ??? ?? ???? ???? ? Navicat ??? ?????. 4. SQL ?? ????? ??? ??; 5. ?? ???? ???? ?? ???; 6. ??? ??? ????; 7. ?? ?? ???? ? ??. ??? ??? ?? ??? ?? ???? ??? ????? ??? ? ??? ?????? ??? ???? ???? ???? ? ????.

MongoDB?? ??? ?????? ???? ??? ?????. 1. ?? ????? ???? ?? UpdateOne ? Updatemany ??? ?????. 2. $ set, $ inc ? $ push? ?? ???? ???? ?? ????? ??????. ??? ??? ???? ???? MongoDB?? ???? ????? ???? ???? ? ? ????.

.bak ??? ???? ?? Navicat? ???? ??? ??? ????. 1. Navicat? ?? SQLServer ????? ??????. 2. ? ??????? ???? ?? ??????? ??????. 3. ?? ????? ?? ? ATABASESQL ?? ???? ???? ??? ??? ???? ??????. 4. ?????? ??, ?? ??, WithReplace ? ?? ??? ???? ???? ??? ???? ???? ??????.

JDBC? ???? Oracle Database Connection Pool? ???? ???? ??? ?????. 1) ?? ? ??, 2) ?? ??? ?? ?? ??, 3) SQL ?? ?? ? 4) ???? ????. OracleUcp? ???? ??? ????? ???? ??? ??????.

MySQL ?? ??? ????? ???? ??? ??? ???? ??? ??, ?? ??? ??? ??? SQL ?? ??? ? ?? ??? ?? ??? ? ?? ???? ???????. 1. ???? ????? ???? ?? ??? ???? ???? ????. ??? ID ? ?? ??? ?? ?? ??? ????? ???? ??? ???? ???? ?? ????. ?? ? ??? ?? ???? ?? ???? ??? ? ??? ?? ?? ?? ??? ?????. 2. ?? ??? ??? ???, ??? ?? ???? ???? ???? ?? ???? ?? ??? ??? ???, ?? ??? ??? ??, ?? ?? ? ?? ??; 3. SQL ?? ???, ??? ???, ??? ??? ???, ?? ?? ?? ?? ?? ??? ????, ? ???? ??? ? ? ??? ?? ??? ??????. 4. ????? ???? ???? ?? ???? ?????

MongoDB?? ?? ??????? ?? ??? "showdbs"??? ???? ????. 1.? ??? ?? ?? ?? ?????? ? ?????. 2. "??"??? ?? ??????? ???? ???? ???? ?? ? ? ????. 3. "??"? "??"? ?? ?? ?????????? ??????. 4. ????? ???? ?? "ListDatabases ()"???? ???? ??? ??? ??????. 5. "db.stats ()"??? ??? ?????? ??? ? ? ????.
