I want to get the exact match value of a specific array.
input: { “filter.schedule” : [“sat”, “sun”]}
example data :
{
scheduleDays: ['sat', 'sun']
},
{
scheduleDays: ['sun']
},
{
scheduleDays: ['sat']
},
{
scheduleDays: ['mon', 'sun']
} ...
i hope trying to
[
{
$match: {
$or: [
{
"scheduleDays": {
$eq: ["sat", "sun"],
},
},
{
"scheduleDays": {
$eq: ["sat"],
},
},
{
"scheduleDays": {
$eq: ["sun"],
},
},
],
},
},
]
so, i tried convert atlas search compound query.
[
{
$search: {
// index: "",
compound: {
filter: [
{
equals: {
path: "isActive",
value: true,
},
},
{
geoWithin: {
path: "location",
circle: {
center: {
type: "Point",
coordinates: [
// 0,
// 0
],
},
radius: 50000,
},
},
},
{
compound: {
should: [
{
text: {
path: "scheduleDays",
query: ["sat", "sun"],
},
},
{
text: {
path: "scheduleDays",
query: ["sat"],
},
},
{
text: {
path: "scheduleDays",
query: ["sun"],
},
},
],
},
},
],
must: [
{
near: {
origin: {
type: "Point",
coordinates: [
// 0,
// 0
],
},
pivot: 5000,
path: "location",
score: {
boost: {
value: 3,
},
},
},
},
],
should: [],
},
count: {
type: "total",
},
scoreDetails: true,
highlight: {
path: [
// ""
],
},
},
},
{
$limit: 20,
},
{
$skip: 0,
},
{
$addFields: {
scoreDetails: {
$meta: "searchScoreDetails",
},
score: {
$meta: "searchScore",
},
highlights: {
$meta: "searchHighlights",
},
total: "$$SEARCH_META.count.total",
},
},
]
Is it possible to change compound.filter to $eq syntax, not $in?
thx.