mongodb-js / mongodb-schema

Infer a probabilistic schema for a MongoDB collection.

Home Page:https://github.com/mongodb-js/mongodb-schema

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

allow categories for other types, like numbers, dates

rueckstiess opened this issue · comments

Instead of converting string to text / category type, provide native type and add a boolean flag $category.

Provide a parameter to determine how many values make a category.

Proposal for new schema schema:

{
    $count: 100,
    field: {
        $count: 50,
        $prob: 0.5, 
        $type: 'number',
        $array: true,
        $category: true,
        $hist: [ 
            {v: 1, c: 34}, 
            {v: 2, c: 15}, 
            {v: 0, c: 1},
            {o: 23432}
        ],
        $stats: {
            min: 0,
            max: 2,
            mean: 1.3231,
            std: 0.062
        }
    }
}