MongoDB regex pattern or wildcard in query key

I have to somehow set a wildcard in one of the keys of my mongodb request. To *.files.FileIDalso check the following keys of my document: root.files.FileID root.folders.0.files.FileID

My attempt was to simply do this: db.user_folders.find({ '*.files.FileID' : 6 }) But it does not return any results.

+4
source share
1 answer

The only query operators that act on document fields (as opposed to the value of these fields) are $existsand $type.

There are basically two ways:

  • ( ), ;
  • MongoDB ( , " " ).
0

All Articles