I have a several documents with the following props:
{
'_id':the_id
'relationships': [{
'rel_name': 'HAS_TAG'
'rel_destination': 'TAG'
},{
'rel_name': 'HAS_CORE_TAG'
'rel_destination': 'TAG'
}]
}
Some documents have a larger list of relationships
and those relationships always have a rel_name
and a rel_destination
.
I'm banging my head to make a mongodb query so it can:
- find all documents that have at least one
rel_name
=HAS_CORE_TAG
in relationships - replace all
rel_name
=HAS_CORE_TAG
toHAS_NEW_TAG
is that possible in one query? or should I iterate through all documents and the list relationships
on each document?