Skip to content

Latest commit

 

History

History
21 lines (16 loc) · 333 Bytes

sort-by-count.md

File metadata and controls

21 lines (16 loc) · 333 Bytes

Demo for Sort By Count

Example of code

import {AggregateBuilder} from 'mongodb-aggregate-builder';

const aggBuilder = new AggregateBuilder();
aggBuilder.sortByCount("$tags");
console.log(JSON.stringify(aggBuilder.build(), null, 2));

Result

[
    {
        "$sortByCount": "$tags"
    }
]