Skip to content

Handling Arrays #12

@KaitaniLabs

Description

@KaitaniLabs

Great package!

I have an issue with handling arrays. I'm using untranspose to convert into a mongodb modifier.

Input data looks like this:

{
   tracking: true,
   blocked: true,
   nsfw: false,
   categories: { 
       subscribed: [ 'xag2vJYrDJdsyZfah', 'abpxCb6pN3aR4piMw' ],
       blocked: [] 
   },
   sources: { 
      subscribed: [ '4QSh8AqECuPauHFor' ], 
      blocked: [] 
   }
}

Output data looks like this:

{
    'tracking': true,
    'blocked': true,
    'nsfw': false,
    'categories.subscribed[0]': 'xag2vJYrDJdsyZfah',
    'sources.subscribed[0]': '4QSh8AqECuPauHFor'
}

I was expecting/would prefer this:

{
    'tracking': true,
    'blocked': true,
    'nsfw': false,
    'categories.subscribed': ['xag2vJYrDJdsyZfah', 'abpxCb6pN3aR4piMw'],
    'sources.subscribed': ['4QSh8AqECuPauHFor']
}

Could we include an optional flag to not break down arrays? Also, it seems a little buggy in its current format because it only included the first array element not the second.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions