Open velidan opened 2 years ago
I don't really use Nest nor Mongoose much, but have you tried to pass Order
instead of OrderSchema
into resources
? Unless @nestjs/mongoose
schema is different than mongoose
schema. Our current documentation (https://docs.adminjs.co/installation/adapters/mongoose) and demo app doesn't use @nestjs/mongoose
Hi @dziraf , thank you for your feedback. Yes, I tried to use the Order but it also doesn't work. Probably it's a bit different than the mongoose native stuff. So, if I understand correctly, if I want to use the Admin.js with Nest.js I shouldn't use their mongoose package but rather use the native mongoose schema, etc. ?
I'm 99.9% certain that with native mongoose package and schema it will work. Still, if it doesn't work with @nestjs/mongoose
that isn't good too. It's strange though as other @nestjs/package
work fine. If it's possible can you prepare a repository where I can reproduce this so I can prepare a fix?
The line which fails is: https://github.com/SoftwareBrothers/adminjs-mongoose/blob/master/src/resource.ts#L60
I'd assume that in your case this.MongooseModel
is actually a schema so it doesn't have .schema
property.
i had the same issue, the console said: "cannot read property 'paths' of undefined"
@dziraf Hi, I've tried to create a single dedicated repo with the minimal amount of code that contains the issue, hope it helps. If you need some help, please, let me know: https://github.com/velidan/adminjs-nestjs-mongoose-issue
to reproduce an issue: 1) install node_modules 2) run the mongod (mongo server) 3) stand the nest.js app (yarn start:dev) 4) try to open the Admin.js page http://localhost:3000/admin
Kind regards!
Is there any fix for this?
any fix for this?
Any fix for this?
Describe the issue When I try to use the mongoose schema from the official Nest.js documentation Mongo with Mongoose as a resource for the Admin.js the error occurs and the Admin.js doesn't work. The error:
Installed libraries and their versions
To Reproduce Steps to reproduce the behavior:
Install Nest.js (latest), install Mongo/mongoose, and all the required Admin.js packages.
Create a Nest.js Mongoose schema as it described in the official documentation Mongo with Mongoose
Import the Mongoose Schema and use it as a Resource in Admin.js
See the error
Expected behavior Admin.js should work fine Screenshots creating the Nest.js schema and using it as a resource for Admin.js: the Error: The Nest.js Mongo documentation page:
AdminJSOptions with schema
Desktop (please complete the following information if relevant):
Additional context I'm wondering how to use the Nest.js mongoose implementation with the Admin.js. It looks like the Admin.js documentation is missing this chapter because the Entity way that is described in the Admin.js documentation can't be applied for the latest Nest.js mongoose approach.
Thanks for any help!