I'm following the tutorial from https://real-time-dashboard.cube.dev/cube-js-api-with-mongo-db
, and get dataset from there which look like this below.
And my schema set like this below.
cube(`Events`, {
sql: `SELECT
*
FROM stats.events`,
refreshKey: {
sql: `SELECT UNIX_TIMESTAMP()`,
},
measures: {
count: {
type: `count`,
},
online: {
type: `countDistinct`,
sql: `${anonymousId}`,
filters: [{ sql: `${timestamp} > date_sub(now(), interval 3 minute)` }],
},
pageView: {
type: `count`,
filters: [{ sql: `${eventType} = 'pageView'` }],
},
buttonClick: {
type: `count`,
filters: [{ sql: `${eventType} = 'buttonClicked'` }],
},
urlIsNotEmpty: {
type: `count`,
filters: [{ sql: `${url} = https://cubejs-real-time-demo.herokuapp.com/#/` }],
},
urlIsEmpty: {
type: `count`,
filters: [{ sql: `${url} = ''` }],
},
},
dimensions: {
secondsAgo: {
sql: `TIMESTAMPDIFF(SECOND, timestamp, NOW())`,
type: `number`,
},
anonymousId: {
sql: `${CUBE}.\`anonymousId\``,
type: `string`,
},
eventType: {
sql: `${CUBE}.\`eventType\``,
type: `string`,
},
url: {
sql: `\`url\``,
type: `string`,
},
timestamp: {
sql: `${CUBE}.\`timestamp\``,
type: `time`,
},
referrer: {
sql: `\`events.referrer\``,
type: `string`,
},
id: {
sql: `${CUBE}._id`,
type: `string`,
},
},
});
id, enveyType, anontymouseId, secondsAgo work fine. But, When i try to access url
and referrer
i got error like this Unknown column 'events.url' in 'field list'
, Error: Error: Unknown column 'events.referrer' in 'field list'
. Anyone help?