Skip to content

Features: createMany, mutation for an existing array #35

@andersonlin

Description

@andersonlin

hello~

Do we have plan to add createMany, and recordIds returns the array of ObjectIDs, records returns the updated objects.

//createMany
var array = [{ name: 'Star Wars' }, { name: 'The Empire Strikes Back' }];
Movies.insertMany(array, function(error, docs) {});

Could we support mutation for updating an array field if I pass an ObjectId that adding to the existing array instead of overwrite, the overwrite only happens if I pass an array of ObjectId?

The first mutation for phones and returns two values for phones being "111-222-333-444", "444-555-666-777".

mutation {
  userCreate(record: {
    contacts: {
      phones: [
        "111-222-333-444",
        "444-555-666-777"
      ]
    },
  }) {
    recordId
    record {
      contacts {
        email
        phones
      }
    }
  }
}

{
  "data": {
    "userCreate": {
      "recordId": "593ca1149f15dd003778ba1f",
      "record": {
        "contacts": {
          "email": null,
          "phones": [
            "111-222-333-444",
            "444-555-666-777"
          ]
        }
      }
    }
  }
}

The second mutation for phones, the expected returns are three values for phones being "111-222-333-444", "444-555-666-777", "444-555-666-888" instead of "444-555-666-888".

mutation {
  userCreate(record: {
    contacts: {
      phones: "444-555-666-888"
    },
  }) {
    recordId
    record {
      contacts {
        email
        phones
      }
    }
  }
}

{
  "data": {
    "userCreate": {
      "recordId": "593ca1149f15dd003778ba1f",
      "record": {
        "contacts": {
          "email": null,
          "phones": [
            "111-222-333-444",
            "444-555-666-777",
            "444-555-666-888"
          ]
        }
      }
    }
  }
}

thanks,
anderson

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions