Best way to remove an item from an array (not using Ember Data)

I have a model that contains an array of images like this:

"gallery" : [ 
    {
        "_id" : ObjectId("5499f6cea66483d54bad151d"),
        "description" : "X",
        "title" : "Test1234",
        "meta" : {
            "position" : 0
        },
        "src" : {
            "large" : "http://cdn.imagepath/gallery-photos/image_gallery_000.jpg",
            "medium" : "http://cdn.imagepath/gallery-photos/image_gallery_000.jpg",
            "small" : "http://cdn.imagepath/gallery-photos/image_gallery_000_sm.jpg"
        }
    }, 
    {
        "description" : "",
        "title" : "",
        "_id" : ObjectId("549ae002b078644011254066"),
        "meta" : {
            "position" : 1
        },
        "src" : {
            "large" : "http://cdn.imagepath/gallery-photos/image_gallery_001.jpg",
            "medium" : "http://cdn.imagepath/gallery-photos/image_gallery_001.jpg",
            "small" : "http://cdn.imagepath/gallery-photos/image_gallery_001_sm.jpg"
        }
    }, 
    {
        "description" : "",
        "title" : "",
        "_id" : ObjectId("549ae002b078644011254065"),
        "meta" : {
            "position" : 3
        },
        "src" : {
            "large" : "http://cdn.imagepath/gallery-photos/image_gallery_002.jpg",
            "medium" : "http://cdn.imagepath/gallery-photos/image_gallery_002.jpg",
            "small" : "http://cdn.imagepath/gallery-photos/image_gallery_002_sm.jpg"
        }
    }, 
    {
        "description" : "",
        "title" : "",
        "_id" : ObjectId("549ae05eb078644011254067"),
        "meta" : {
            "position" : 2
        },
        "src" : {
            "large" : "http://cdn.imagepath/gallery-photos/image_gallery_003.jpg",
            "medium" : "http://cdn.imagepath/gallery-photos/image_gallery_003.jpg",
            "small" : "http://cdn.imagepath/gallery-photos/image_gallery_003_sm.jpg"
        }
    }
]

What is the best way to delete one of the items of the array and save my model without using Ember Data?

popObjectā€¦Iā€™m a dink

There is also removeObject.

2 Likes