How to nested find in mongodb with collection data below :
{
"_id": {
"$oid": "585b998297f53460d5f760e6"
},
"newspaper": {
"playerID": "57bffe76b6a70d6e2a3855b7",
"playerUsername": "dennis",
"player_newspaper": "{\"ID\":\"57bffe76b6a70d6e2a3855b7\",\"Username\":\"Dennis\",\"itemName\":\"Corn\",\"Comment\":\"Jagung Promo\",\"Date\":\"12/27/2016\"}"
}
}
My code :
var datex = new Date();
var dates = datex.getMonth() + '/' + datex.getDate() + '/' + datex.getFullYear();
db.playerNewspaper.remove( {"newspaper.player_newspaper.Date": dates } } } ) ;
This is not working.
and
That's how I insert the data:
var currentPlayer = {
"playerID": playerID,
"playerUsername": playerUsername,
"player_newspaper": newspaper
}; // we construct a new player from the data we are about to input into the player data
playerDataList.insert(
{
"newspaper" : currentPlayer
} // Uses the $set mongo modifier to set old player data to the current player data
);