No; a map function by design is only allowed to look at the document passed into it. Otherwise if documentB changes but documentA doesn’t, then the index values emitted by documentA would be out of date.
You’ll need to do this with two views and a hand-made join:
- View A maps from documentA to documentB, i.e. its map function detects a documentA and emits its documentB ID.
- View B maps the specific field of documentB, i.e. emits that field.
First you query view B to find all documentBs that have that value in them. Then you query view B setting the ‘keys’ property to that array of documentB IDs, and you’ll get rows for all the documentAs.
—Jens