1

I have a (simplified) query that looks as follows.

var pageViews = new Keen.Query('count', {
    eventCollection: 'Loaded a Page',
    groupBy: 'company.id'
});

And use it as follows.

client.run(pageViews, function(result, error) {
    // Do something here
});

This will give me the following JSON to work with:

{
  "result": [
    {
      "company.id": 1,
      "result": 3
    },
    {
      "company.id": 2,
      "result": 11
    },
    {
      "company.id": 3,
      "result": 7
    }
  ]
}

However, I would also like to get back the name of each company, i.e. the company.name property. I looked through keen.io's documentation, and I could find no way of doing this. Is there a way to do this? Logically speaking, I don't see any reason why it would not be possible, but the question is if it has been implemented.

ba0708
  • 10,180
  • 13
  • 67
  • 99

1 Answers1

2

Grouping by multiple properties will get you what you're looking for:

var pageViews = new Keen.Query('count', {
    eventCollection: 'Loaded a Page',
    groupBy: ['company.id','company.name']
});

That being said, it's important to note that Keen is not an entity database. Keen is optimized to store and analyze event data, which is different than entity data. More complex uses of entity data may not perform well using this solution.

terrhorn
  • 510
  • 4
  • 6