Insert js variables in projection?

Driver code (like the above js string concat) can be mixed with mongo code,but the driver code runs before sending the query to mongo.

sensor is a js variable not a mongo variable

Its helpful to use driver code to generate mongo queries many times,not just a string concat
like here.

1 Like