The Stags, whose squad includes former Magpies midfielder James Perch, are currently sixth in League Two under Nigel Clough.
Former England under-20 international Longstaff has made 20 appearances for the Magpies - 14 of them in the Premier League - and spent the first part of the season on loan with Scottish Premiership side Aberdeen.
The 21-year-old progressed through the ranks with his boyhood club and burst onto the scene with the winner against Manchester United on his Premier League debut in October 2019 - one of three goals he scored in his breakthrough campaign.
He made only five appearances last term following a long-term injury but signed a contract extension at St. James' Park in the summer before moving to Aberdeen.