按用户过滤mongodb数据

时间:2019-02-21 11:56:40

标签: angular mongodb typescript devexpress devextreme

我在mongodb有一组乐队数据和用户。 我想做的是:乐队数据包含诸如'band: band 1', 'band: band 2', 'band: band 3'之类的数据。 (还有其他数据,但是我写了我想使用的东西)。

我希望用户在注册时输入频段数据,以找出注册时用户所在的频段。 显示数据时:如果频段数据等于频段,我希望用户显示磁带。我想执行某种过滤过程。我想以这种方式进行上市。你能帮忙吗?

通过这种方式,我列出了乐队数据:

refreshLineList() {
  this.lineService.getLineList().subscribe(res => {
      this.lineService.lines = res as Line[]; //Line = band data
      console.log(res);
  });
}

要吸引用户数据:

ngOnInit() {
    this.refreshLineList();
    this.userService.getUserProfile().subscribe(
      res => {
        this.userDetails = res['user'];
        console.log(res);
      },
      err => {
        console.log(err);
      }
    );
  }

用户的控制台输出:

> {status: true, user: {…}}
status: true 
user:
 bant: "Bant 1"  // **this is the part I should use in my filter**
 email: "e@e.com" > 
>  fullName: "esra"
> __proto__: Object
> __proto__: Object

将乐队数据输出到控制台:

(4) [{…}, {…}, {…}, {…}]
0:
bant: "Bant 1"  // **this is the part I should use in my filter**
bantKisiSayisi: 2
calisilanToplamSure: 2
devamsizlikYuzdesi: 11.11111111111111
diger: 2
hatVerimliligi: 1
hataOrani: 200
ikinciKaliteAdedi: 2
ikinciKaliteOrani: 50
ilaveCalisilanDk: 2
ilaveCalisma: 0.06666666666666667
isKazasi: 2
iseGelmeyenlerinToplamSuresi: 2
koliCikisAdedi: 2
planlamayaUyum: 100
planlananAdet: 2
ramakKala: 2
sam: 2
sevkiyattanGelenHata: 2
tamirAdedi: 2
tarih: "2019-02-20T08:03:40.935Z"
__v: 0
_id: "5c6ac88edb48bf3850eebc75"
__proto__: Object
1: {_id: "5c6ac8acdb48bf3850eebc76", bant: "Bant 2", isKazasi: 0, ramakKala: 0, tamirAdedi: 2, …}
2: {_id: "5c6b14973eade027f4083dc4", bant: "Bant 1", isKazasi: 2, ramakKala: 0, tamirAdedi: 88, …}
3: {_id: "5c6d1ca109b191294856dcf9", bant: "Bant 3", isKazasi: 0, ramakKala: 0, tamirAdedi: 80, …}
length: 4
__proto__: Array(0)

0 个答案:

没有答案