Lab: Using Cursor-like Stages

Hi. I am at my wit’s end. The following pipeline does not work. I cannot even assign this as a pipeline, because I am receiving the error:

SyntaxError: illegal character :
@(shell):8:0

I cannot locate my error. My code s below:

var pipeline = [
	{
		$match : {
			countries : "USA",
			"tomatoes.viewer.rating" : { $gte : 3 },
			cast: {
				$in : [
					“Sandra Bullock”,
					“Tom Hanks”,
					“Julia Roberts”,
					“Kevin Spacey”,
					“George Clooney”
				]
			}
		}
	},
	{
		$project : {
			title : 1,
			cast : 1,
			"tomatoes.viewer.rating" : 1,
			_id : 0
		}
	},
	{
		$addFields : {
			num_favs : {
				$size : { 
					$setIntersection : [ 
						[
							“Sandra Bullock”,
							“Tom Hanks”,
							“Julia Roberts”,
							“Kevin Spacey”,
							“George Clooney”
						], 
						"$cast" 
					] 
				}
			}
		}
	},
	{
		$sort: {
			num_favs : -1,
			"tomatoes.viewer.rating" : -1,
			title : -1
		}
	}
]

I’d greatly appreciate being pointed in the right direction.

The pipeline looks quite alright (I didn’t test the result). @shell(8:0) seems to be related to the first character line 8, which is the quotation mark.

Try manually typing them, so they look straight, like this

"

and not like this

2 Likes

You are a hero, Santiago. Great eye, thank you very much.

1 Like