-
Notifications
You must be signed in to change notification settings - Fork 26
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
Model.insertOne() - returns array #25
Comments
Thanks for opening an issue. Do you mean it should return an array or that it does and the docs are wrong? |
I would imagine, .insertOne() would return an object (without an nesting array). I get: expected: I base this upon .findOne() or .findById() does indeed only return an object (without the nesting array). |
Ah yes, I remember this. We're simply proxying the call to the driver's hapi-mongo-models/lib/base-model.js Line 439 in 11fa7a6
According to the docs:
Which defines the result as a If we chose to change this, it would be a major version bump as the API would change. Is it really worth it? |
I'm new to Mongo, so not really in any position to advise on what is worth it. I just believed to have discovered an Inconsistency error, but being an artifact from the driver, it might be outside your domain. Appreciate your framework and your kind support, I hope its not to much trouble too ask. |
We could change it in this library, but I prefer to do as little as possible in that regard.
That's always nice to hear. Thanks :) Always feel free to ask questions. |
Model.insertOne() - Workaround to output an object, instead of array with an object
|
Seems to me, like Model.insertOne() will return an array with 1 object, instead of just the object.
The text was updated successfully, but these errors were encountered: