Can't remove the first element of an array in a document


#1

I’m trying to pop the first element off of a few arrays in the same document, but it ends up removing the last element. It works correctly via mongo shell.

Here’s my meteor method:

Meteor.methods({
  'queue-pop'(roomId){
    check(roomId, String);

    return Queues.update({roomId}, {
          $pop: {
             url: -1,
             title: -1,
             uploader: -1,
             description: -1
           }
         });
       }
});

I’m just stumped as to why it won’t pop the first element. Any help would be appreciated! :+1: