```await this.prismaService.post.findFirst({ whe...
# orm-help
s
Copy code
await this.prismaService.post.findFirst({
  where: {
    postUid,
  }
});
I want to duplicate na data result, is there a function out there I can use?
r
@See Jee 👋 Could you explain what you meant by duplicate?
s
Copy code
const post = await this.prismaService.post.findFirst({
  where: {
    postUid,
  }
});


// post <--- I want to create new record of this except with postUid

// something like this
const newPost = post->duplicate()
newPost->create()
r
You can do that in JavaScript itself:
Copy code
const post = await this.prismaService.post.findFirst({
  where: {
    postUid,
  }
});

const { id, ...newPost } = post;

await this.prismaService.post.create({ data: newPost });
s
Thank you. I will try that.
👍 1