GraphQl Query Document Join


I want to do a Query by going through two different documents, is it possible to do it ?

Document A { _id, senders_ID[sender_id],email}
Document B { sender_id, firstname}

// i want to loop through document A and get each sender_id and go to document B to get the firstname.


I’m sure it is possible, but not quite understanding the schema of your Document A. Is senders_ID[sender_id] an array field in the document? Probably would need you to post more code to give a good example as well. Are these documents in two different collections?


Thank you for response let me explain it to you :

Document 1 :

    "_id": "456d456d67exa",
    "MovieName": "Forest",
    "senders": [
    "version": "4.2.0",
    "hardware": "5",

I want to go through the senders List

and do somehting like this :slight_smile:

 Promise.all( => Meteor.users.findOne({ "_id": sender })))
  .then((UserLists) => {
     // Deals with ok
     for (var i=0; i<UserLists.length; i++)
     for (var profile in UserLists[i]) {
         console.log("Name of user: "+UserLists[i][profile].name);
  .catch((err) => {

Exemple of a the document of the "_id": "zAxNarwAE2AnvPb8P", that i want to get the emails.adress +

    "_id": "zAxNarwAE2AnvPb8P",
    "createdAt": {
        "$date": "2018-04-16T09:45:10.212Z"
    "emails": [
            "address": "",
            "verified": false
    "profile": {
        "features": {
            "pictures": false
        "name": "Jean-Paul"


I want to get in a table the MovieName + the senders ( email + name )


One way to do it.

In gql schema for current_box:

type CurrentBox {
    _id: ID,
    MovieName: String,
    senders: senderProfiles,
    version: String,
    hardware: String

In the resolver for current_box:

CurrentBox: {
  senderProfiles(root) {
    return Meteor.users.find({ _id: { $in: root.senders } }, { fields: { emails: 1, profile: 1 } }).fetch();

It replaces your senders array with the data array of user profiles you wanted for the query.

See this warning about profile:


Sir please i updated my question here Nested query returns empty array