title: Convert Observable of Observable into simple Observable
body: <p>I am very new to rxjs and have read dozen of tutorials but it's still quite confusing. 
  Let's say I have a list of user ids, and every 3 seconds I would like to query some data (online game match info) for each user from REST service. Several users might have played the same match, so getLastMatch() may return same match id for different users. I would like to group the resulting stream by match id.
  So, for user 1 I get match id 101, 2 -> 100, and 3 -> 101.
  I would like my observable to emit something like </p>
  
  <pre><code>{
      [
      {"match": 101, "players": [1, 3]},
      {"match": 100, "players": [2]},
      ]
  }
  </code></pre>
  
  <p>Here is the code I came up with so far, but I'm stuck with last line producing 
  Observable&lt;Observable&lt;MatchData&gt;&gt;</p>
  
  <pre><code>class MatchData{
    constructor(public matchId: number, public won: boolean) {}
  }
  
  const players = [1, 2, 3];
  
  function getLastMatch(userId: number): Observable&lt;MatchData&gt; {
    let data = new MatchData(100 + userId % 2, userId % 2 == 0);
    return Observable.fromPromise(new Promise&lt;MatchData&gt;(resolve =&gt; resolve(data))));
  }
  
  const scheduler = Observable.interval(3000);
  scheduler.map(Observable.from(players.map(p =&gt; getLastMatch(p))));
  </code></pre>
  
  <p><strong>UPD:</strong></p>
  
  <p>This is what I ended up with.</p>
  
  <pre><code>class MatchData {
    constructor(public playerId: number, public matchId: number) {}
  }
  
  class GroupedMatchData {
    constructor(public matchId: number, public playerIds: number[]) {}
  }
  
  const accounts = [1, 2, 3];
  const scheduler = Observable.interval(3000);
  
  function getMatch(id: number): Observable&lt;MatchData&gt; {
    let promise = new Promise&lt;MatchData&gt;(resolve =&gt; resolve(new MatchData(id, 100 + id % 2)));
    return Observable.fromPromise(promise);
  }
  
  function requestMatchData(): Observable&lt;GroupedMatchData&gt; {
    return Observable.from(accounts.map(account =&gt; getMatch(account)))
      .mergeAll()
      .groupBy(match =&gt; match.matchId, match =&gt; match.playerId)
      .flatMap(group =&gt; group.reduce((accumulator, current) =&gt; [...accumulator, current], [group.key]))
      .map(array =&gt; new GroupedMatchData(array[0], array.slice(1)));
  } 
  
  scheduler.take(1).flatMap(requestMatchData).subscribe(console.log);
  </code></pre>
  
  <p>Any comments on my solution are appreciated.</p>