Oct 7, 2024
sh برای اتصال، CLS برای پاک کردن صفحه، exit برای قطع اتصالshow dbsuse <dbname>use <newdbname>db.createCollection(<collectionName>)db.dropDatabase()db.<collectionName>.insertOne({<document>})db.<collectionName>.insertMany([{<doc1>}, {<doc2>}, ...])db.<collectionName>.find().sort({<field>: 1}) برای صعودی، -1 برای نزولیdb.<collectionName>.find().limit(<number>)db.<collectionName>.find({<query>})db.<collectionName>.find({}, {name: 1, GPA: 1})db.<collectionName>.updateOne({<filter>}, {$set: {<field>: <value>}})db.<collectionName>.updateMany({<filter>}, {$set: {<field>: <value>}})db.<collectionName>.updateOne({<filter>}, {$unset: {<field>: 1}})db.<collectionName>.deleteOne({<filter>})db.<collectionName>.deleteMany({<filter>})$eq, $ne, $gt, $gte, $lt, $lte برای مقایسه مقادیر$and, $or, $nor, $not برای پرسوجوهای پیچیدهdb.<collectionName>.createIndex({<field>: 1})db.<collectionName>.dropIndex(<indexName>)db.createCollection(<collectionName>, {options})db.<collectionName>.drop()