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

Issue with ObjectId fields #43

Open
avalla opened this issue Jul 10, 2018 · 1 comment
Open

Issue with ObjectId fields #43

avalla opened this issue Jul 10, 2018 · 1 comment

Comments

@avalla
Copy link

avalla commented Jul 10, 2018

Hello,

I have not found any smart issue to manage this problem, the adapter changes the _id field as string, but I have also other ObjectId fields (some references to other collections) and they are not converted to string, so I need to call a toString() for doing other queries, but moleculer validation prevents to call service.getusing an object id or with null values.

My database has some optional references to other entities, so there are null values. I think that is not possible to manage directly, because validator throws an error...

Example

Thanks to everyone :)

[2018-07-10T11:11:26.843Z] INFO  mac-mini-di-andrea.local-20730/TEST: test.save STARTING...
[2018-07-10T11:11:26.853Z] INFO  mac-mini-di-andrea.local-20730/TEST: test.save: { _id: '5b44945e0362e150fa37a60d', _idType: 'string', field: 000000000000000000000001, fieldType: 'object', fieldString: '000000000000000000000001', fieldStringType: 'string' }
[2018-07-10T11:11:26.857Z] INFO  mac-mini-di-andrea.local-20730/TEST: test.save - forcing validation error, using an object for doing: broker.call("test.get", { _id: test.field });
Error occured! Parameters validation error!
@hienp
Copy link

hienp commented Mar 4, 2020

oh

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