You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This means that the same call as before no longer works. The correct way to send in a single test object is now
//This is now required await mongoUnit.load({"collection": [{...object}]);
h1. Solutions
At minimum, we should mention this in the ReadMe and consider adding it as a javadoc-style comment to the load function. The load function could also check to see if the object it received is an array, and decide whether to use insert or insertMany depending on that. I'm happy with making either of these changes for you.
Great tool, by the way! :)
The text was updated successfully, but these errors were encountered:
Thank you for comment @AlexanderPruss
you are right, I braked it a bit once I update mongo driver
I'm happy with making either of these changes for you.
it will be great and I'll release 2.0.0
I think the better solution will be just update documentation and make API always expect array as input param (less variability is always better for stability)
h1. Problem:
In version
1.4.4
, you could load an individual test object into mongo unit. Suppose I had an object namedobject
-//This used to be ok
await mongoUnit.load({ "collection": {...object});
In the current version 1.5.1,
load
has been changed to useinsertMany
instead of justinsert
- here's the position in the code. 06d131f#diff-168726dbe96b3ce427e7fedce31bb0bcL73-R84This means that the same call as before no longer works. The correct way to send in a single test object is now
//This is now required
await mongoUnit.load({"collection": [{...object}]);
h1. Solutions
At minimum, we should mention this in the ReadMe and consider adding it as a javadoc-style comment to the
load
function. Theload
function could also check to see if the object it received is an array, and decide whether to useinsert
orinsertMany
depending on that. I'm happy with making either of these changes for you.Great tool, by the way! :)
The text was updated successfully, but these errors were encountered: