Alice52 / database

ddf13ad8d4be76a80a336418b5cf5727bf6e3059
gitee.com
MIT License
0 stars 0 forks source link

[overview] mongodb #4

Open Alice52 opened 1 year ago

Alice52 commented 1 year ago

version

  1. 4.2
  2. 4.4

index

ha

rerference

  1. mysql&mongo 索引树: https://zhuanlan.zhihu.com/p/519658576
Alice52 commented 1 year ago

resource

  1. ReferenceCards15-PDF.pdf
  2. MongoDB实战.pdf
  3. MongoDB复制集环境搭建.pdf
  4. MongoDB分片集群搭建.pdf
Alice52 commented 1 year ago
  1. sample
    
    show dbs;

use tutorial;

show collections;

db.createCollection("products");

db.products.insertMany([ { title: 'A', category_id: ObjectId('574d92332a2b10d7618b4575'), price: 30.23, rating:5 }, ]);

db.getCollection("collection").drop();

db.products.find();

db.products.createIndex({price:1}) db.products.getIndexes();

db.products.find({category_id:ObjectId('574d92332a2b10d7618b4575')}).sort({price:-1}).explain("allPlansExecution");