Skip to content

Latest commit

 

History

History
28 lines (20 loc) · 450 Bytes

File metadata and controls

28 lines (20 loc) · 450 Bytes

Demo for Project with showFields

Using for projection to show fields

Example of code

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

const aggBuilder = new AggregateBuilder();
aggBuilder.project(showFields('data', 'password'));
console.log(JSON.stringify(aggBuilder.build(), null, 2));

Result

[
    {
        "$project": {
            "data": 1,
            "password": 1
        }
    }
]