0
0
mirror of https://github.com/naturalcrit/homebrewery.git synced 2025-12-31 08:42:40 +00:00

Add fields to Mongoose query

This commit is contained in:
G.Ambatte
2022-04-28 11:09:32 +12:00
parent 3fb4c5bdd9
commit cffe08b785
2 changed files with 7 additions and 5 deletions

View File

@@ -194,7 +194,9 @@ app.get('/download/:id', asyncHandler(async (req, res)=>{
app.get('/user/:username', async (req, res, next)=>{
const ownAccount = req.account && (req.account.username == req.params.username);
let brews = await HomebrewModel.getByUser(req.params.username, ownAccount)
const fields = 'title pageCount description authors views shareId editId createdAt updatedAt lastViewed';
let brews = await HomebrewModel.getByUser(req.params.username, ownAccount, fields)
.catch((err)=>{
console.log(err);
});