Berikut adalah perbandingan Query :
Menggunakan Set Column ( Area Field )
SQL| SELECT headline, author FROM article; |
MongoDB Aggregation| db.article.aggregate( |
| { $project : { headline : 1, author : 1 } } |
| ); |
Compass Project Option| { headline : 1, author : 1 } |
Menggunakan Sort
SQL| SELECT * FROM article |
| ORDER BY headline ASC; |
MongoDB Aggregation| db.article.aggregate( |
| { $sort : { headline : 1 } } |
| ); |
Compass Sort Option
Menggunakan Offset / Skip
SQL| SELECT * FROM article |
| LIMIT 50 OFFSET 435; |
MongoDB Aggregation| db.article.aggregate( |
| { $limit : 50 }, |
| { $skip : 435 } |
| ); |
Compass Skip Option
Menggunakan Limit
SQL| SELECT * FROM article |
| LIMIT 10; |
MongoDB Aggregation| db.article.aggregate( |
| { $limit : 10 } |
| ); |
Compass Limit Option
Reference : https://www.mongodb.com/docs/compass/master/query/filter/