cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Reactive session with JavaScript

Hello there

I'm trying to make a simple code like this one below work, but it doesn't.
Reactive session poorly documented in the JavaScript driver manual.

Here is the code:

function readTimebarDataReactive(entity,timebar) {
  start = new Date().getTime();
  session
    .run(queryTemplates[entity])
    .records()
    .pipe(
      map(record => record.get('item')),
      concat(rxSession.close())
    )
    .subscribe({
      next: data => {
        timebar.merge(data)
        console.log(data)
      },
      complete: () => {
        timeElapsed('Completed', start)
        timebar.zoom('fit', { animate: false })
      },
      error: err => console.log(err)
    })
};

I tried it many times, always the same thing, the functions map and concat in the pipe function are not defined.

2 REPLIES 2

Hi,

Can you share the imports of your code?
Also, where do the variable session and rxSession come from? Why are they both used here?

Thanks @florent.biville1 for the quick answer

Here is all the files of my tiny code
The import sequence is in the index.html file.

index.html.txt (509 Bytes)
neo4j.js.txt (2.7 KB)
app.js.txt (2.6 KB)

I think map and concat functions are using a module i don't have, it's usually the case with a non-defined error.