My collection has the following structure:
- file_path (string)
- file_contents(object)
- a[] (array)
- b[] (array)
An example document could be like:
- file_path : "/username/innerdirectory/file.txt"
- file_contents:
- a: [0,1,1,1,0]
- b: [0,0,0,1,1]
I am trying to find out all the documents that have a particular file_path
and that have file_contents.a
in them.
My query at the moment looks like this:
db.logs.find({$and:[{'file_path':"/username/innerdirectory/file.txt"},{file_contents.a:{$exists: true}}]})
It says SyntaxError: missing : after property id
Is my query even right?