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

463
Views
Mongoose 6 $group with Typescript -> Property '_id' is incompatible with index signature

Estoy migrando de js a ts y también de mongoose 5.8 a 6.1 El siguiente código funcionaba bien antes

 let getActionsTakenByApp = (store_url: string) => { return AppAction.aggregate([ { $match: { store_url } }, { $group: { _id: { 'action_type': '$action_type' }, count: { $sum: 1 } } } ]); }

Pero ahora mecanografiado ahora muestra este error.

 Type '{ _id: { action_type: string; }; count: { $sum: number; }; }' is not assignable to type '{ [key: string]: { $count?: any; $accumulator?: any; $addToSet?: any; $avg?: any; $first?: any; $last?: any; $max?: any; $mergeObjects?: any; $min?: any; $push?: any; $stdDevPop?: any; $stdDevSamp?: any; $sum?: any; }; _id: any; }'. Property '_id' is incompatible with index signature. Type '{ action_type: string; }' is not assignable to type '{ $count?: any; $accumulator?: any; $addToSet?: any; $avg?: any; $first?: any; $last?: any; $max?: any; $mergeObjects?: any; $min?: any; $push?: any; $stdDevPop?: any; $stdDevSamp?: any; $sum?: any; }'. Object literal may only specify known properties, and ''action_type'' does not exist in type '{ $count?: any; $accumulator?: any; $addToSet?: any; $avg?: any; $first?: any; $last?: any; $max?: any; $mergeObjects?: any; $min?: any; $push?: any; $stdDevPop?: any; $stdDevSamp?: any; $sum?: any; }'.ts(2322)

Todavía soy nuevo en mecanografiar y trato de descubrir cuál es el problema. ¡Cualquier ayuda sería apreciada! ¡¡Gracias!!

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Es un error introducido en 6.1.0

Se solucionará una vez que las relaciones públicas relacionadas se fusionen y se lancen.

Mientras tanto, puede cambiar a una versión anterior.

over 4 years ago · Santiago Trujillo Report
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!