Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First param to schema.plugin() must be a function, got "object" #5

Open
BerkantCanErkanat opened this issue Feb 12, 2023 · 1 comment

Comments

@BerkantCanErkanat
Copy link

Hey,

When I tried to use mongoose-subquery it gave me this error. Where did I do wrong?
Below is where I used it.
Thanks for your help!

import { Schema as _Schema, model } from "mongoose";
import mongooseSubquery from 'mongoose-subquery'
const Schema = _Schema;
const LiveEvent = new Schema({
rEvent: {
type: Schema.ObjectId,
required: true,
ref: "RetrievedEvent",
},
createdAt: {
type: Date,
default: Date.now,
},
});
LiveEvent.plugin(mongooseSubquery)
export default model("LiveEvent", LiveEvent);

@paksa92
Copy link

paksa92 commented Nov 2, 2023

This worked for me:

import { mongooseSubqueryPlugin } from 'mongoose-subquery'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants