How to get my array of object data from database


#1

I am trying to get the title to frontend, but i didn’t get the title to frontend. There are number of users in database i need to get title of that users. Can anyone please help me how to get the title to frontend.

Thanks in advance

my MongoDB structure

artice:Array
0:Object
title:"hello"

my TS component

    this.accountService.getWeb().subscribe(
      response => {
      console.log(response);
      this.userDetails = response;
      },
      err => {
      console.error('User Not found');
      })
      window.scrollTo(0, 0);
  }
}

my HTML component

*ngFor="let articles of userDetails"
{{articles.title}}

my accountService.ts

  getWeb()
    return this.http.post(this.apiPath + 'user/getWeb', {});
  }

my Controller.js

    //Getting Title
userRouter.post('/getWeb', (req, res) => {
    Collections.user.find({}, function (err, result) {
    if (err) return res.status(500).send("There was a problem finding the user");
    if (result) {
    return res.status(200).send(result);
    } else {
   return res.status(500).send("User Not Found with Details: " + JSON.stringify(user));
    }
    });
    });

#2

Is this a Meteor question?


#3

Hi i am prudhvi, I am newly registered in meteor. I don’t no how to get the data from array in mongodb. Can you please tell me how to get the title shows in the above question