- 
    Type:Question 
- 
    Resolution: Done
- 
    Priority:Major - P3 
- 
    None
- 
    Affects Version/s: 2.6.1
- 
    Component/s: Querying
- 
    None
- 
        None
- 
        None
- 
        None
- 
        None
- 
        None
- 
        None
- 
        None
I have a program which inspects every field in a document to see if it an array.
This works fine for:
db.bios.find({$where: "Array.isArray(this.awards)"})
<Returns values>
But not for
db.messages.find({$where: "Array.isArray(this.X-cc)"})
error: 
If I single-quote the parameter value in isArray it breaks the working use case:
db.bios.find({$where: "Array.isArray('this.awards')"})
<No rows return>
and seems to fix the broken use case:
db.messages.find({$where: "Array.isArray(this.X-cc)"})
<No rows returned instead of an error>
What I'm looking for is a generic solution that can be used in both scenarios.
Thanks,
Brad