We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hi, I'm starting to use neogma in my project and found out that the return value of .findMany() and QueryBuilder() seems to be different.
QueryRunner.getResultProperties is extracting the properties only
.run(neogma.queryRunner) .then<SuccessResult<ProjectsInstance[]>>((result) => { return { type: Result.SUCCESS, data: QueryRunner.getResultProperties<ProjectsInstance>(result, 'project'), }; })
but findMany() only returns the whole instance
return await Projects.findMany({ where: { }, order: [['projectID', 'ASC'], ['projectDescription', 'ASC']], throwIfNoneFound: true, session: null, }).then<SuccessResult<ProjectsInstance[]>>((result) => { return { type: Result.SUCCESS, data: result }; }) .catch((error) => ({ type: Result.ERROR, message: error.message, error, }));
is there any way to convert instance into properties only? or do it by myself? that instance has "dataValues" property so I need that data only.
[ { "labels": [ "Project" ], "__existsInDatabase": true, "dataValues": { "projectID": "prj-003", "projectDescription": "CCC project", "createdBy": "001", "createdOn": "1996-08-16 00:00:00.000" }, "changed": { "projectID": false, "projectDescription": false, "createdBy": false, "createdOn": false } }, ]
The text was updated successfully, but these errors were encountered:
Hey, thanks for using neogma :)
Currently there is no way to support it, and you'll have to do a map to get only the dataValues.
map
dataValues
However, some ORMs like sequelize have an option to get only the data itself, which is something I can look at :)
Sorry, something went wrong.
Find plain records (#63)
8eecefc
Closes #58. - Add `plain` param to `findOne` and `findMany` to return the plain properties.
Released in v1.12.0. You can just pass a plain: true param to findMany and findOne and it should work as you described.
plain: true
findMany
findOne
Documentation
Successfully merging a pull request may close this issue.
Hi, I'm starting to use neogma in my project and found out that the return value of .findMany() and QueryBuilder() seems to be different.
QueryRunner.getResultProperties is extracting the properties only
but findMany() only returns the whole instance
is there any way to convert instance into properties only? or do it by myself?
that instance has "dataValues" property so I need that data only.
The text was updated successfully, but these errors were encountered: