Giter Club home page Giter Club logo

Comments (6)

mjfwebb avatar mjfwebb commented on June 10, 2024 1

Sure, here's what I did:

import { ApolloServer } from "@apollo/server";
import { startStandaloneServer } from "@apollo/server/standalone";
import { Neo4jGraphQL } from "@neo4j/graphql";
import { OGM } from "@neo4j/graphql-ogm";
import neo4j from "neo4j-driver";

const driver = neo4j.driver(
  "bolt://localhost:7687",
  neo4j.auth.basic("username", "password")
);

const typeDefs = `#graphql
  type User {
      id: ID! @id
      firstName: String!
      lastName: String!
      email: String! @unique
  }
`;

const ogm = new OGM({ typeDefs, driver });
const User = ogm.model("User");

const resolvers = {};

const neoSchema = new Neo4jGraphQL({
  typeDefs,
  driver,
  resolvers,
});

async function main() {
  const schema = await neoSchema.getSchema();
  await ogm.init();
  const server = new ApolloServer({
    schema,
  });

  const { url } = await startStandaloneServer(server, {
    context: async ({ req }) => ({ req }),
  });

  console.log(`🚀 Server ready at ${url}`);
  const [record] = await User.find({
    where: { id: "your-id-here" },
  });

  console.log(record);
}

main();

Where you replace your-id-here with the id generated. I selected the ID from when I created the user through a mutation:

mutation Mutation {
  createUsers(
    input: [{ email: "[email protected]", firstName: "First", lastName: "Last" }]
  ) {
    users {
      id
    }
  }
}

from graphql.

neo4j-team-graphql avatar neo4j-team-graphql commented on June 10, 2024

Many thanks for raising this bug report @gethassaan. 🐛 We will now attempt to reproduce the bug based on the steps you have provided.

Please ensure that you've provided the necessary information for a minimal reproduction, including but not limited to:

  • Type definitions
  • Resolvers
  • Query and/or Mutation (or multiple) needed to reproduce

If you have a support agreement with Neo4j, please link this GitHub issue to a new or existing Zendesk ticket.

Thanks again! 🙏

from graphql.

mjfwebb avatar mjfwebb commented on June 10, 2024

Hi @gethassaan I tried to reproduce this, but I can successfully request specific users via their IDs, without any issue.

Some thoughts:

  • Did you create the users through GraphQL? It might be an ID mismatch if you made them yourself elsewhere.
  • Can you test without having a NestJS service in between? NestJS may be causing a problem. Perhaps a cache?

from graphql.

gethassaan avatar gethassaan commented on June 10, 2024

Hey @mjfwebb, I created the user via Graphql and the ID's were auto generated and regarding the cache i'm sure it's not cache since I also tried this with a new (fresh) clone.

And as I am trying a simple query as mentioned above, I am out of clues to why this might be happening. 🥲

Can you also share how did you fetch the users? Any process or steps that you followed?

from graphql.

gethassaan avatar gethassaan commented on June 10, 2024

Thank you @mjfwebb your solution does work, I am not sure why would the bug be coming up. 🤔

from graphql.

mjfwebb avatar mjfwebb commented on June 10, 2024

@gethassaan I'll close the issue then, since we confirmed it's not on our side.

from graphql.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.