Skip to content

Using $pop to remove an array item causes an error #406

Open
@Shelagh-Lewins

Description

@Shelagh-Lewins

I have a schema which defines an array like this:

'myArray': {
	'type': Array,
},
'myArray.$': {
	'type': Date,
},

I'm trying to remove an element from the end of the array like this:

MyCollection.update({ _id }, { $pop: { myArray: 1 }})

This gives a server error:

MongoError: Expected a number in: myArray:

If I bypass Collection 2 like this, the operation succeeds:

MyCollection.update({ _id }, { $pop: { myArray: 1 }}, { 'bypassCollection2': true })

So it looks like there is some bug with collection2 and the $pop operation on arrays?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions