Please write a node.js code that queries and exports data to a CSV file. A list of usernames and emails of users, who are members of private groups and joined the group in the November of 2021 is expected in the file. (Please refer to the Data Schema
section for more detail)
The example of file content is shown below. (Please note that the 1st line is the headers.)
Group Name,Username,Email
Group 1,user1,[email protected]
The sorting must match the following orders.
- Sort by group name ascending
- Sort by username ascending
Please write a node.js code that updates all the users in the mongodb by capitalizing the first letter of their own usernames. For example:
username:
user1 => User1
john-doe => John-doe
Schema files are located in the /schemas
folder. The folder contains 3 schema files as listed here.
- User
- Group
- Group User
An idividual user must have username and eamil registered in the system.
The meta.isPrivate
field is a flag to specify if a group is private or not.
It is composed of group id and user id. The createdAt
field can be used to determine when a user joined a group.