How to use the neo4j-driver/lib/v1/temporal-types.Date function in neo4j-driver

To help you get started, we’ve selected a few neo4j-driver examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github johnymontana / spacetime-reviews / src / App.js View on Github external
.run(
        `
        MATCH (b:Business)<-[:REVIEWS]-(r:Review)
        WHERE $start <= r.date <= $end AND distance(b.location, point({latitude: $lat, longitude: $lon})) < ( $radius * 1000)
        OPTIONAL MATCH (b)-[:IN_CATEGORY]->(c:Category)
        WITH r,b, COLLECT(c.name) AS categories
        WITH COLLECT(DISTINCT b {.*, categories}) AS businesses, COLLECT(DISTINCT r) AS reviews
        UNWIND reviews AS r
        WITH businesses, r.stars AS stars, COUNT(r) AS num ORDER BY stars
        WITH businesses, COLLECT({stars: toString(stars), count:toFloat(num)}) AS starsData
        RETURN businesses, starsData`,
        {
          lat: mapCenter.latitude,
          lon: mapCenter.longitude,
          radius: mapCenter.radius,
          start: new Date(
            startDate.year(),
            startDate.month() + 1,
            startDate.date()
          ),
          end: new Date(endDate.year(), endDate.month() + 1, endDate.date())
        }
      )
      .then(result => {
        console.log(result);
        const record = result.records[0];
        const businesses = record.get("businesses");
        const starsData = record.get("starsData");

        this.setState({
          businesses,
          starsData
github johnymontana / spacetime-reviews / src / App.js View on Github external
WHERE $start <= r.date <= $end AND distance(b.location, point({latitude: $lat, longitude: $lon})) < ($radius * 1000)
        WITH DISTINCT b
        OPTIONAL MATCH (b)-[:IN_CATEGORY]->(c:Category)
        WITH c.name AS cat, COUNT(b) AS num ORDER BY num DESC LIMIT 25
        RETURN COLLECT({id: cat, label: cat, value: toFloat(num)}) AS categoryData
    `,
        {
          lat: mapCenter.latitude,
          lon: mapCenter.longitude,
          radius: mapCenter.radius,
          start: new Date(
            startDate.year(),
            startDate.month() + 1,
            startDate.date()
          ),
          end: new Date(endDate.year(), endDate.month() + 1, endDate.date())
        }
      )
      .then(result => {
        console.log(result);
        const categoryData = result.records[0].get("categoryData");
        this.setState({
          categoryData
        });
        session.close();
      })
      .catch(e => {
        console.log(e);
        session.close();
      });
  };