Expressive Query Operator

db.collection_name.find({"$expr": {<expression>}})
db.trips.find({"$expr": {"$eq": ["$start station id", "$end station id"]}}).pretty()
db.trips.find({
	"$expr": {
		"$and": [
			{"$gt": ["$tripduration": 1200]},
			{"$eq": ["$start station id": "$end station id"]}
		]
	}
})

Practice Question

Find how many companies in the sample_training.companies collection have their permalink similar to their twitter username

db.companies.find({"$expr": {"$eq": ["$permalink", "$twitter_username"]}}).count()

Array Operators