$lookup let $match limitation

Hi,
I have a question, about limitations:

Limitations:

  • Multikey indexes are not used.
  • Indexes are not used for comparisons where the operand is an array or the operand type is undefined.
  • Indexes are not used for comparisons with more than one field path operand.

In short, I didn’t quite understand the limitations
I would appreciate an example for each limitation.

Also, here this example:

{"$lookup", bson.D{
					{"from", "air_airlines"},
					{"let", bson.D{
						{"constituents", "$airlines"}},
					},
					{"pipeline", bson.A{bson.D{
						{"$match", bson.D{
							{"$expr", bson.D{
bson.D{{"$and",
			bson.A{
				bson.D{{"fullDocument.username", "alice"}},
				bson.D{{"operationType", "delete"}}}}},
							}},
						}},
					}}},
					{"as", "airlines"},
				}},

Will this use the indexes or it’s a part of the limitations

(sorry for the code format, I’m submitting this using my phone, so there may be missing brackets, etc… but I hope the idea of what I’m trying to do is clear)

So here what i got so far:

  1. Multikey indexes are not used:
    a multikey index is simply an index on a field where that field is an array. (those are not used)

  2. Indexes are not used for comparisons where the operand is an array or the operand type is undefined:
    exactly as it states, (i just didn’t know the meaning of operand :confused: ) an operand is what the operation is operated on, in those cases the operand is the field. => indexes are not used when you use operators on fields that are arrays or undefined(?)

  3. Indexes are not used for comparisons with more than one field path operand:
    I didn’t get that, anyone can explain this?

1 Like