我如何获得a
参与的所有邮件的光标,并将a
转换为完整的用户名,如果它是alex
?
会话
{ "_id" : "CyiJgeNmxcfRNbnub", "_participants" : [ "a", "b" ] }
{ "_id" : "naZXvcdWdo4QbFDDa", "_participants" : [ "b", "c" ] }
{ "_id" : "ADGuA8PpCS9XKHPoE", "_participants" : [ "a", "c" ] }
消息
{ "_id" : "9MRBdb4QhoX4nXKtw", "body" : "Asdf", "conversationId" : "CyiJgeNmxcfRNbnub", "userId" : "a") }
{ "_id" : "sQYxBrmw69pttCs42", "body" : "Yo", "conversationId" : "naZXvcdWdo4QbFDDa", "userId" : "b") }
{ "_id" : "Hf2vmS54TZbvGbLXT", "body" : "hi", "conversationId" : "ADGuA8PpCS9XKHPoE", "userId" : "c") }
预期结果(userId是发件人的userId)
{ "_id" : "9MRBdb4QhoX4nXKtw", "body" : "Asdf", "conversationId" : "CyiJgeNmxcfRNbnub", "userId" : "a") }
{ "_id" : "Hf2vmS54TZbvGbLXT", "body" : "hi", "conversationId" : "ADGuA8PpCS9XKHPoE", "userId" : "c") }