post by user

This commit is contained in:
Adolfo Reyna
2021-08-15 22:19:35 -07:00
parent 5b9c0362e0
commit f909233533
2 changed files with 11 additions and 3 deletions

View File

@@ -77,8 +77,9 @@ postDB = (DB)=>{
});
}
DB.getPosts = (userObj) => {
return DB.postCols.find().sort({_id: -1}).toArray().catch((err)=>{
DB.getPosts = (userid) => {
let query = userid ? {userid} : {};
return DB.postCols.find(query).sort({_id: -1}).toArray().catch((err)=>{
console.log(err);
return false;
});