N
Nuxt3mo ago
Niza

Nuxt-Mongoose

Hi, I am experiencing an issue with the nuxt-mongoose framework. I am attempting to locate a document in the MongoDB database collection that matches a specific key/field called kinde_id, but I keep receiving an error. Please refer to the attached images above to view the code. I can retrieve (find) documents that match the _id quite alright but kinde_id doesn't work. Could anyone help out with this issue? This is the error I am getting:
No overload matches this call.
Overload 1 of 4, '(filter?: FilterQuery<{ name: "string"; kinde_id: "string"; }> | undefined, projection?: ProjectionType<{ name: "string"; kinde_id: "string"; }> | null | undefined, options?: QueryOptions<...> | ... 1 more ... | undefined): Query<...>', gave the following error.
Type 'string | number | true | Record<string, any> | QueryValue[] | QueryValue[]' is not assignable to type 'Condition<"string"> | undefined'.
Type 'number' is not assignable to type 'Condition<"string"> | undefined'.
Overload 2 of 4, '(filter?: FilterQuery<{ name: "string"; kinde_id: "string"; }> | undefined, projection?: ProjectionType<{ name: "string"; kinde_id: "string"; }> | null | undefined): Query<...>', gave the following error.
Type 'string | number | true | Record<string, any> | QueryValue[] | QueryValue[]' is not assignable to type 'Condition<"string"> | undefined'.
Overload 3 of 4, '(filter?: FilterQuery<{ name: "string"; kinde_id: "string"; }> | undefined): Query<(Document<unknown, {}, { name: "string"; kinde_id: "string"; }> & { name: "string"; kinde_id: "string"; } & { ...; }) | null, Document<...> & ... 1 more ... & { ...; }, {}, { ...; }, "findOne">', gave the following error.
Type 'string | number | true | Record<string, any> | QueryValue[] | QueryValue[]' is not assignable to type 'Condition<"string"> | undefined'.ts(2769)
(property) kinde_id?: Condition<"string"> | undefined
No overload matches this call.
Overload 1 of 4, '(filter?: FilterQuery<{ name: "string"; kinde_id: "string"; }> | undefined, projection?: ProjectionType<{ name: "string"; kinde_id: "string"; }> | null | undefined, options?: QueryOptions<...> | ... 1 more ... | undefined): Query<...>', gave the following error.
Type 'string | number | true | Record<string, any> | QueryValue[] | QueryValue[]' is not assignable to type 'Condition<"string"> | undefined'.
Type 'number' is not assignable to type 'Condition<"string"> | undefined'.
Overload 2 of 4, '(filter?: FilterQuery<{ name: "string"; kinde_id: "string"; }> | undefined, projection?: ProjectionType<{ name: "string"; kinde_id: "string"; }> | null | undefined): Query<...>', gave the following error.
Type 'string | number | true | Record<string, any> | QueryValue[] | QueryValue[]' is not assignable to type 'Condition<"string"> | undefined'.
Overload 3 of 4, '(filter?: FilterQuery<{ name: "string"; kinde_id: "string"; }> | undefined): Query<(Document<unknown, {}, { name: "string"; kinde_id: "string"; }> & { name: "string"; kinde_id: "string"; } & { ...; }) | null, Document<...> & ... 1 more ... & { ...; }, {}, { ...; }, "findOne">', gave the following error.
Type 'string | number | true | Record<string, any> | QueryValue[] | QueryValue[]' is not assignable to type 'Condition<"string"> | undefined'.ts(2769)
(property) kinde_id?: Condition<"string"> | undefined
My ./server/api/users/index.get.ts file
The userModel for the database (auto imported by nuxt)
3 Replies
Niza
Niza3mo ago
bump
oneeach
oneeach3mo ago
Are you importing your userModal in your index.get.ts?
Niza
Niza3mo ago
Hi, yes it gets auto imported. I figured out the solution My Schema/Modal is incorrect