Hi I’m trying to only show rating between 7 and 10. The rating part by itself works fine. If I want to sort it it’s not working.
[{rating: {$gt:6, $lt: 10}}, {$sort: {rating: -1}}]
// // Select the database to use.
use(“movies-databse”)
db.movies.drop()
// Insert a few documents into the movies collection.
db.movies.insertMany(
[
{"_id": 1, “title”: “First Movie”, “year”: “2000”, “rating”: 10, “Genre”: “Drama”, “language”: “English”},
{"_id": 2, “title”: “Second Movie”, “year”: “2001”, “rating”: 9, “Genre”: “Thriller”, “language”: “English”},
{"_id": 3, “title”: “Third Movie”, “year”: “2002”, “rating”: 9, “Genre”: “Comedy”, “language”: “English”},
{"_id": 4, “title”: “Fourth Movie”, “year”: “2020”, “rating”: 8, “Genre”: “Drama”, “language”: “Russian”},
{"_id": 5, “title”: “Fifth Movie”, “year”: “2004”, “rating”: 1, “Genre”: “Drama”, “language”: “Russian”},
]);