• python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Facebook Twitter Instagram
Devs Fixed
  • python
  • javascript
  • reactjs
  • sql
  • c#
  • java
Devs Fixed
Home » Resolved: error TS2339: Property ‘remove’ does not exist on type ‘Document

Resolved: error TS2339: Property ‘remove’ does not exist on type ‘Document 0

By Isaac Tonny on 16/03/2023 Issue
Share
Facebook Twitter LinkedIn

In this post, we will see how to resolve error TS2339: Property ‘remove’ does not exist on type ‘Document<unknown,

Question:

I’m getting this error on my application
runtime Error :
TSError: ⨯ Unable to compile TypeScript: src/controllers/notes.ts:134:20 – error TS2339: Property ‘remove’ does not exist on type ‘Document<unknown, {}, { createdAt: NativeDate; updatedAt: NativeDate; } & { title: string; text?: string | undefined; }> & Omit<{ createdAt: NativeDate; updatedAt: NativeDate; } & { …; } & { …; }, never>’.
134 await note.remove()
highlighted Error :
any Property ‘remove’ does not exist on type ‘Document<unknown, {}, { createdAt: NativeDate; updatedAt: NativeDate; } & { title: string; text?: string | undefined; }> & Omit<{ createdAt: NativeDate; updatedAt: NativeDate; } & { …; } & { …; }, never>’.ts(2339)
Controllers/notes
model/notes
router/notes

Best Answer:

Guessing you are following the same tutorial.
if you want to keep:
then use
remove() can no longer be used (src: How do I remove documents using Node.js Mongoose?)

If you have better answer, please add a comment about this, thank you!

Source: Stackoverflow.com

express mongoose node.js typescript
Share. Facebook Twitter LinkedIn

Related Posts

Resolved: Openlayers: Update clusters depending on filter (geometryFunction)

24/03/2023

Resolved: Getting ‘502 Bad Gateway’ while deploying Springboot app in EKS

24/03/2023

Resolved: Why is NGINX’s $request_uri empty?

24/03/2023

Comments are closed.

© 2023 DEVSFIX.COM

Type above and press Enter to search. Press Esc to cancel.