I have an array of movies pulled from MongoDB, named movieList:
[
{
movie: {
_id: 5fde62aa0cec1598fda103ac,
title: 'Wander'
},
status: 2
},
{
movie: {
_id: 5fde62930cec1598fd9d426c,
title: 'Mulan'
},
status: 1
},
{
movie: {
_id: 5fde62a10cec1598fd9f9222,
title: 'Greenland'
},
status: 0
}
]
And I have an array of movie Object IDs (not strings), named removeMovies:
[
5fde62a20cec1598fd9fa275,
5fde62a30cec1598fd9fec86,
5fde62a50cec1598fda034cf,
5fde62a50cec1598fda03f24,
5fde62930cec1598fd9d426c
]
The way that I would normally filter (if these were strings or numbers, as opposed to Object IDs) returns an empty array:
const filteredMovieList = movieList.filter((movie) => {
return removeMovies.includes(movie.movie._id)
})
Any ideas?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…