Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

320
Views
NestJS, Schema @Prop decorator can't take more than 1 argument?

Below I have two Properties on my GraphQL Schema. They are both of types number, however I'm quite sure you have to explicitly set them to () => Int. This works in my second @Prop scene_description, as it's only 1 argument. However for the top @Prop tvshow_episode, it doesn't let me both explicitly declare an Int, and have options like unique and index. Can someone explain the difference to me here and what is the best practice?

import { Int } from '@nestjs/graphql';
import { Prop, Schema, SchemaFactory } from '@nestjs/mongoose';
import { Document } from 'mongoose';

export type SongToEpisodeDocument = SongToEpisode & Document;

@Schema({
  timestamps: true,
})
export class SongToEpisode {
  @Prop(() => Int, { unique: true, index: true })
  tvshow_episode: number;

  @Prop(() => Int)
  scene_description: number;
}

The error it gives is Expected 0-1 arguments, but got 2.ts(2554)

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!