Google Cloud Datastore Retrieval

Hi I am following this tutorial and have successfully validated that my data has reached the Google Cloud pub/sub and Datastore. Tutorial found here:
https://docs.particle.io/tutorials/integrations/google-cloud-platform/

However I am also interested in writing a nodeJS script/ server file to view the contents of the Datastore. I have successfully ran a JS function with a for loop and console.log() statements however when I substitute my parameters and query the server, this is where I have issues. My query does not print anything to the screen, aka is blank but I know there is 83 entries in the database. I am also trying to print this to a website using a homegrown hbs website. I used this as a template but was unsuccessful:

Are there any recommendations that might be helpful? Thanks. Mike

@Nrobinson2000 Are you familiar with NodeJS on Google cloud at all?

Update: I am now getting results however they are not the right results. I need to access everything but the Symbol(KEY) shown below. Thoughts? Thanks.

async function listmyData() {
  const query = datastore.createQuery('ParticleEvent').order('published_at')
    //.select('__key__') // only gives key
    .limit(3)
    .order('published_at');
    //.filter('__key__', '>', datastore.key(['Task', 'someTask']))
  //console.log(query);
  const [eaPoint] = await datastore.runQuery(query);
  
    for (const taskmike of eaPoint) {
         const taskKey = taskmike[datastore.KEY];
         console.log(taskKey.id, taskmike);  // send output from defined query.
     }
    
    console.log(colors.blue('End of my data'))
}

results:

5632499082330112 { data: <Buffer 74 65 73 74 2d 65 76 65 6e 74>,
  gc_pub_sub_id: '439120639426144',
  event: 'my_event',
  published_at: '2019-11-01T14:30:36.335Z',
  device_id: 'api',
  [Symbol(KEY)]:
   Key {
     namespace: undefined,
     id: '5632499082330112',
     kind: 'ParticleEvent',
     path: [Getter] } }
End of my data

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.