I am trying to query multiple Vector Embeddings with $unionWith
Code:
const documents = await collection
.aggregate([
{
$unionWith: {
coll: "SearchLeads",
pipeline: [
{
$vectorSearch: {
queryVector: embedding,
path: "industry_embedding",
numCandidates: 10000,
limit: 30,
index: "default",
},
},
{
$vectorSearch: {
queryVector: embedding,
path: "city_embedding",
numCandidates: 10000,
limit: 30,
index: "default",
},
},
],
},
},
])
.toArray();
return documents;
and I am getting this error while searching $vectorSearch is not allowed within a $unionWith’s sub-pipeline reference.
Cluster version: 6.0.13
Tier: M10 (General)