rest.li icon indicating copy to clipboard operation
rest.li copied to clipboard

How will the projectFields behave if a field being masked not appear in result

Open xiawang opened this issue 8 years ago • 1 comments

For example, if our mask is:

{
    a:1,
    b:1
}

while the result is:

{
    {
        a:'apple'
    },
     {
        a:'apple1'
        b:'bee'
    }
}

After field projection, will the first record

    {
        a:'apple'
    }

be removed so that only the second record is left? Or the first record would not change? Thank you.

xiawang avatar Jul 31 '18 00:07 xiawang

No, projectFields does not remove records. It just filters out the fields that are not in the projection mask.

With the mask of a:1,b:1 the 'c' element would be removed from the response below:

{
    {
        a:'apple'
    },
     {
        a:'apple1',
        b:'bee',
        c:'lemon'
    }
}

joelhare avatar Jul 31 '18 04:07 joelhare