feliixx/mgodatagen

`int` generator without further configuration always generates `0`

Closed this issue · 1 comments

Hi!

Maybe this one is somehow related to #92

Having the following configuration file

[
  {
    "database": "someDatabase",
    "collection": "someCollection",
    "count": 10,
    "content": {
      "someInt": {
        "type": "int"
      }
    }
  }
]

what I get in the database is the following

Screenshot from 2022-09-01 12-01-38

I already noticed something similar with the string generator, where I needed to specify minLength and maxLength, or else I got the empty string all the time.

As soon as one adds minInt and maxInt it starts to generate values other then 0. This is also similiar to how string generator behaves, as it starts to generate values as soon as minLength and maxLength are given. Unfortnuatly this does not help with stringFromParts (see #92)

See the following playground for an interactive example for int:

https://mongoplayground.net/p/u_dNIJBpf3R

And here for string without further configuration:

https://mongoplayground.net/p/yxQ3BcABvlV

I've been thinking about this and indeed it can be improved

I've updated the code to set default bounds if none are present in version 0.11.0