Closed eaimounir closed 5 years ago
I assume that the problem is from crud-typeorm that uses createQueryBuilder I understand we have to use createCursor/createEntityCursor instead of createQueryBuilder. https://github.com/typeorm/typeorm/blob/master/docs/mongodb.md For information, the getOne and getMany functions fail with the error because of createQueryBuilder but createOne works. So, I guess that crud-typeorm does not fully support mongodb. Do you have plans for that?
Too bad that MongoDB is not supported yet. I like the idea, that generates the normal CRUD Routes automatically.
@bashleigh I don't think that we will support typeorm mongodb. I was planning to build @nestjsx/crud-mongoose
instead because Mongoose seems to be more popular orm and we already have a package in nestjs org.
The second reason - I don't want to make things more complicated with @nestjsx/crud-typeorm
package which is already way too complex by itself.
So I'm going to close this.
Lets start using Handlebars since it is more popular and mature than Angular and React.
@Stradivario thanks for your valuable comment. I really appreciate it 👍
I like people with a sense of humor because your comparison really made my day :)
https://www.npmjs.com/package/handlebars
https://www.npmjs.com/package/@angular/core
Just looked at those weekly downloads numbers and the rest of the day seems to be not so shitty, ha? :)
But seriously, nobody restricts you of creating something like @nestjs/crud-typeorm-mongo
OR adding a new TypeOrmMongoCrudService
to the existing @nestjs/crud-typeorm
package, cover it with tests, and make a PR with the description saying that this functionality will help you and others despite the fact that mongoose service is de-facto available in another branch and on its way to being released. That would be more productive communication from your side instead of just trying to reply with some unnecessary irony (which in fact was not really successful but nice try 👍 )
You get it too personal i am making many contributions and dont have time at the moment to prepare such a pull request. Dont get me wrong maybe it was not as good as it should be but it was worth to try ;) Glad that i make your day :)) it is good to be happy.
@zMotivat0r there is a very missleading sell here. The very second selling point of the repo description is "DB and service agnostic extendable CRUD controllers". How can it be db agnostic if it supports only sql likes through typeorm? Please advertise this restriction properly.
nextjs/crud looks awesome but that's the missing feature that'll probably prevent us from using next all together. Who want to write, test and maintain all the scaffolding code for basic rest operations?
@zMotivat0r which branch are you referring to for the mongose service? I can't find any on this repo.
this is not fair
TypeORM should sponsor mongo full-tilt even with a type for mongoose too it cant build queries Query Builder isnt even supported
both spectrums should have been done prior to anything SQL
is anything being done to make mongodb and mongoose just as ripe as your best connector module for TypeORM
I cant even retrieve documents and Im not even using query builder
http://localhost:3333/nestApi/permission
{"statusCode":500,"message":"Internal server error"}
type: 'mongodb',
host: '127.0.0.1',
url: 'mongodb://localhost:27017/energy',
port: 27017,
database: 'energy',
useUnifiedTopology: true,
synchronize: false,
[Nest] 71737 - 05/20/2021, 1:21:28 AM [RouterExplorer] Mapped {/nestApi/permission/bulk, POST} route +0ms
[Nest] 71737 - 05/20/2021, 1:21:28 AM [RouterExplorer] Mapped {/nestApi/permission/:id, PATCH} route +1ms
[Nest] 71737 - 05/20/2021, 1:21:28 AM [RouterExplorer] Mapped {/nestApi/permission/:id, PUT} route +0ms
[Nest] 71737 - 05/20/2021, 1:21:28 AM [RouterExplorer] Mapped {/nestApi/permission/:id, DELETE} route +0ms
[Nest] 71737 - 05/20/2021, 1:21:28 AM [NestApplication] Nest application successfully started +12ms
Listening at http://localhost:3333/nestApi
No type errors found
Version: typescript 4.1.3
Time: 12387ms
[Nest] 71737 - 05/20/2021, 1:21:37 AM [ExceptionsHandler] Query Builder is not supported by MongoDB. +8541ms
Error: Query Builder is not supported by MongoDB.
at MongoRepository.createQueryBuilder (/Users/meanstack02/new/energy/src/repository/MongoRepository.ts:71:15)
at PermissionService.createBuilder (/Users/meanstack02/new/energy/node_modules/@nestjsx/crud-typeorm/src/typeorm-crud.service.ts:267:31)
at PermissionService.getMany (/Users/meanstack02/new/energy/node_modules/@nestjsx/crud-typeorm/src/typeorm-crud.service.ts:99:32)
at PermissionController.getManyBase (/Users/meanstack02/new/energy/node_modules/@nestjsx/crud/src/crud/crud-routes.factory.ts:205:27)
at /Users/meanstack02/new/energy/node_modules/@nestjs/core/router/router-execution-context.js:38:29
at processTicksAndRejections (internal/process/task_queues.js:93:5)
so it seems I have to junk everything I wrote
I cannot even GET a document out of the database
do I have any options?
why is mongodb specified as a viable backend with typeorm if it wont even work
this is really unnerving
Error: Query Builder is not supported by MongoDB.
at MongoRepository.createQueryBuilder (/Users/meanstack02/new/energy/src/repository/MongoRepository.ts:71:15)
at PermissionService.createBuilder (/Users/meanstack02/new/energy/node_modules/@nestjsx/crud-typeorm/src/typeorm-crud.service.ts:267:31)
at PermissionService.getMany (/Users/meanstack02/new/energy/node_modules/@nestjsx/crud-typeorm/src/typeorm-crud.service.ts:99:32)
at PermissionController.getManyBase (/Users/meanstack02/new/energy/node_modules/@nestjsx/crud/src/crud/crud-routes.factory.ts:205:27)
at /Users/meanstack02/new/energy/node_modules/@nestjs/core/router/router-execution-context.js:38:29
at processTicksAndRejections (internal/process/task_queues.js:93:5)
Actually, I found although QueryBuilder() is not supported, as in the definition file of MongoRepository.d.ts, I could use MongoRepository 's other methods to go without any problems.
/**
* Using Query Builder with MongoDB is not supported yet.
* Calling this method will return an error.
*/
createQueryBuilder(alias: string, queryRunner?: QueryRunner): SelectQueryBuilder<Entity>;
For example: I need to write some pagination functions.
const [items, num] = await Repository.findAndCount({
where : { name: 'John' },
take: 10,
skip: 0,
order: { block: 'DESC'}
});
Other options can be found in file FindOneOptions.d.ts
Is it resolved or do we need to find the other way for pagination?
@alexlu0917 Does this fork maybe solve the problem?
Hasn't it been finalised , what's the status ?
I'm trying to use nestjsx/crud with mongodb but I'm getting the following: [Nest] 8634 - 2019-07-09 12:52 [ExceptionsHandler] Query Builder is not supported by MongoDB. +194380ms Am I doing something wrong or the library doesn't support mongodb?