Hi ,
I need help or suggestion around running a built in function from mongoshell. Earlier mongo version has db.eval which provides function output but its deprecated now and couldnt use in my recent version of the mongshell.
2nd question , My aggregate logic is below, can I store this as system saved function if so how. I want to later access this using function. function lookup(key1,key2,key3,key4)
Example :
db.collection_new.aggregate([
{
$lookup :{
from: 'collection_ref',
let :{key1 :"$key1",
key2:"$key2",
key3:"$key3",
key4:"$key4"
},
pipeline:[
{$match:{
$expr:{
$and : [{$eq :["$key1","$$key1"]},
{$eq :["$key2","$$key2"]},
{$eq :["$key3","$$key3"]},
{$eq :["$key4","$$key4"]}
]
}
}
}],
as : "result"
}}})