[DOCS-12838] Document that Expressions don't support array indexes in the dot notation Created: 30/Jun/19  Updated: 30/Oct/23

Status: Closed
Project: Documentation
Component/s: manual, Server
Affects Version/s: None
Fix Version/s: Server_Docs_20231030

Type: Bug Priority: Major - P3
Reporter: Dan Dascalescu Assignee: Unassigned
Resolution: Won't Do Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
Participants:
Days since reply: 1 year, 14 weeks, 2 days ago
Epic Link: DOCSP-1769
Story Points: 0.25

 Description   

Description

I'm trying to find documents containing an array with equal values at positions 0 and 1. This query produces all documents in the collection:

db.collection.find({
  $expr: {
    $eq: ["$arr.0", "$arr.1"]
  }
})

(see this MongoPlayground)

Is it documented somewhere that Expressions don't support array index dot notation? They do support object dot notation field paths.

More discussion in this SO Q&A, in which user Ashh claimed that `"You cannot use field names inside the expr"`, but I couldn't figure out if they were quoting some official docs, and the ensuing discussion ended up being rather confusing.

Scope of changes

  • Investigate behavior of `$expr` with `$eq` and array index dot notation
  • Update documentation as appropriate

Impact to Other Docs

MVP (Work and Date)

Resources (Scope or Design Docs, Invision, etc.)



 Comments   
Comment by Education Bot [ 31/Oct/22 ]

Hello! This ticket has been closed due to inactivity. If you believe this ticket is still important, please reopen it and leave a comment to explain why. Thank you!

Generated at Thu Feb 08 08:06:14 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.