I have two collection vmdetails and rsc_installtion_status , i want to select the documents from rsc_installtion_status which do not have matching hostname in vmdetails
I used the below query
db.rsc_installtion_status.aggregate([{$lookup:{ from: "vmdetails",let: {rschostname: "$hostname"},pipeline:[{$match:{$expr:{$ne :["$hostname","$$rschostname"]}}}],as: "rscInstall"}},{$unwind:"$rscInstall"},{$project:{"_id":0,"rscInstall":0}}])
the no of records in vmdetails
> db.vmdetails.find().count()
4
the no of records in
> db.rsc_installtion_status.find().count()
37
out of 37 three documents match with documents in vmdetails so i expect the result to be 34 documents but the outcome what i get is 3 records for each document ie 34X3
{ "hostname" : "string", "configdownload" : "string", "rscpkgdownload" : "string", "configextraction" : "string", "rscpkgextraction" : "string", "rscstartup" : "string", "installedversion" : "string", "_class" : "com.mastercard.rsc.domain.RscInstalltionStatus" }
{ "hostname" : "string", "configdownload" : "string", "rscpkgdownload" : "string", "configextraction" : "string", "rscpkgextraction" : "string", "rscstartup" : "string", "installedversion" : "string", "_class" : "com.mastercard.rsc.domain.RscInstalltionStatus" }
{ "hostname" : "string", "configdownload" : "string", "rscpkgdownload" : "string", "configextraction" : "string", "rscpkgextraction" : "string", "rscstartup" : "string", "installedversion" : "string", "_class" : "com.mastercard.rsc.domain.RscInstalltionStatus" }
but in the $match if i use $eq instead of $ne the results are correct it only outputs three records. how can i select the records which do not match with hostname
JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)