Tag: mongoose
-
Best way to performantly resolve nested GraphQL queries with MongoDB
0 I am trying to write a resolver which gets the accounts belonging to a customer. The parent.accounts attribute is an array of account_ids. In the code below, I attempt to get an array of accounts for each customer. import Account from "../models/accounts.js"; import Customer from "../models/customers.js"; import { AccountInterface } from "../types/accounts.js"; import {…
-
Best way to resolve nested GraphQL queries with MongoDB
0 I am trying to write a resolver which gets the accounts belonging to a customer. The parent.accounts attribute is an array of account_ids. In the code below, I attempt to get an array of accounts for each customer. import Account from "../models/accounts.js"; import Customer from "../models/customers.js"; import { AccountInterface } from "../types/accounts.js"; import {…
-
GraphQL/APOLLO – Cannot query field “field_name” on type “Query”
0 I am trying to make a query like this in the latest apollo/server 4.9 and graphqlClient – 3.7 like below: const USER_DATA = gql` query getUserData($subdomain: String!) { getUserData(subdomain: $subdomain) { _id full_name email valid_complex_password projects { _id image_url title description street_address city province country } } } but keep getting this: { "errors":…
-
Node.js, Apollo Server v4, GraphQL, Mongoose – Category Tree
1 I am trying to create Category Tree with Node.js, Apollo Server v4, GraphQL, Mongoose technologies. But when I want to get the created Category or Subcategory data, the output is not what I want. Categories appear both in subCategories as a reference and as a normal category. I also added category data with this…
-
Node.js, Apollo Server, GraphQL, Mongoose – Category Tree
0 I am trying to create Category Tree with Node.js, Apollo Server, GraphQL, Mongoose technologies. But when I want to get the created Category or Subcategory data, the output is not what I want. Output; { "data": { "getCategories": { "success": true, "response_code": "categories-successfully-retrieved", "message": "Categories Successfully Retrieved!", "categories": [ { "_id": "655a1b6018951b0985fd7635", "name": "K…
-
NestJS – Avoid returning user’s password
2 I have a little problem with my project using GraphQL and Mongoose (code-first approach). I have a findCurrentUser query in my user’s resolver that returns the information about the currently authenticated user, but I don’t want to return the user’s password, how I can avoid this? User’s Resolver: @Query(() => User) @UseGuards(GqlAuthGuard) async findCurrentUser(@CurrentUser()…
-
How to handle a dynamic query in the GraphQL without doing the changes specific to the query filters in the backend logic? Please let me know
0 How to handle a dynamic query in the GraphQL without doing the changes specific to the query filters in the backend logic? Please let me know. I found the way to handle the same using the Mongoose Framework and REST API. rest mongoose graphql Share Improve this question Follow asked 3 hours ago Narra…
-
What is the difference between GraphQL and mongoose?
-2 I am reading a book about GraphQL, and they claim that one strong point of GraphQL is selecting a field from the database. See sample below: On this image, they selected just the title from the movies on the database. I can do the same using mongoose, using "select". Could I say that mongoose…
-
Graphql: “message”: “ID cannot represent value: 5a72240cf31713598588b70f”
7 I use moongose for work with mongodb on nodejs based app. Currently, I try to implement Grapqhl based API. My query graphql schema looks like: const schema = buildSchema(` type Query { predictionModels(active: Boolean): [PredictionModel] }, type PredictionModel { _id: ID title: String active: Boolean } `) but when I use: query { predictionModels(active:…
-
Nest Js Graphql Resolve Field with Circular Dependency
0 I have a problem with a circular dependency in a GraphQL model. I’m using Nestjs Graphql MongoDb Mongoose ad I have 3 entities. @ObjectType() @Schema({ timestamps: true }) export class User { @Field(() => ID) _id: string; @Field({ nullable: true }) @Prop({ nullable: true, unique: true }) pseudoDiscord?: string; } @ObjectType() @Schema({ timestamps: true…