Skip to content

$addToSet not behaving as it should  #424

@dor-benatia

Description

@dor-benatia

Hi , iv'e stumbled across a weird problem with mongo $addToSet in patch function,

i am running this code :

service.create({
'test':'1,
'links':['a','b']
})

after that i am doing : super.patch(null,{ '$addToSet': { links: [ 'test1', 'test2', 'test3' ] }}, { 'test':1 });
when looking at the object in the db i see links: ['a','b',test1', 'test2', 'test3' ] which correspond to $addToSet with $each operator as explained in these docs: https://docs.mongodb.com/manual/reference/operator/update/addToSet/#value-to-add-is-an-array

which should of added this array as single element.

what am I missing?

feathers-mongoose version: 8.5.1
mongo 4.2.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions