I have a small mongo document which looks like this:
{
    "_id": {
        "$oid": "5aa441e898cc0b32a819be0c"
    },
    "details": {
        "Artist": "Cyndi Lauper",
        "Album": "She's So Unusual",
        "ReleaseYear": 1983
    },
    "SongID": 1,
    "SongTitle": "Girls Just Want To Have Fund"
}
I need to pull the Artist element out of the details array but keep the data in the overall document. The resulting document needs to look like this:
{
    "_id": {
        "$oid": "5aa441e898cc0b32a819be0c"
    },
    "details": {
        "Album": "She's So Unusual",
        "ReleaseYear": 1983
    },
    "SongID": 1,
    "SongTitle": "Girls Just Want To Have Fund",
    "Artist": "Cyndi Lauper"
}
I'm new to mongo so I'm not to strong in this. The collection is called songs so am thinking I need to do something like this:
db.songs.updateOne({},{$set : {"Artist":$pull{"detail.Artist"}}})
Any help and/or suggestions are greatly appreciated.
Jonathan
 
    