How would I get the cursor of all of the messages that a
has participated in and transform a
into the full username if it is it alex
?
conversations
{ "_id" : "CyiJgeNmxcfRNbnub", "_participants" : [ "a", "b" ] }
{ "_id" : "naZXvcdWdo4QbFDDa", "_participants" : [ "b", "c" ] }
{ "_id" : "ADGuA8PpCS9XKHPoE", "_participants" : [ "a", "c" ] }
messages
{ "_id" : "9MRBdb4QhoX4nXKtw", "body" : "Asdf", "conversationId" : "CyiJgeNmxcfRNbnub", "userId" : "a") }
{ "_id" : "sQYxBrmw69pttCs42", "body" : "Yo", "conversationId" : "naZXvcdWdo4QbFDDa", "userId" : "b") }
{ "_id" : "Hf2vmS54TZbvGbLXT", "body" : "hi", "conversationId" : "ADGuA8PpCS9XKHPoE", "userId" : "c") }
expected result (userId is userId of sender)
{ "_id" : "9MRBdb4QhoX4nXKtw", "body" : "Asdf", "conversationId" : "CyiJgeNmxcfRNbnub", "userId" : "a") }
{ "_id" : "Hf2vmS54TZbvGbLXT", "body" : "hi", "conversationId" : "ADGuA8PpCS9XKHPoE", "userId" : "c") }