.createBulk()

Creates and pushes more than one entry into the collection.

createBulk(data)

Parameter

Description

data

Array

Entries' data

Returns

Description

The newly created entries

// Note: Posts is a collection.
// This collection was created with a default
// value of 'Wow, such empty content' for the 'content' key
// and an incrementable key called 'id' with its value starting from 0.

Posts.createBulk([
  { content: 'This is my #1 post!' },
  { content: 'This is my #2 post!' }
]); // [{ id: 0, content: 'This is my #1 post!' }, { id: 1, content: 'This is my #2 post!' }] 

Last updated