Sails: Docs for `.create()` are incorrect

Created on 25 Jan 2018  路  8Comments  路  Source: balderdashy/sails

======================================================

BEGIN VERSION INFO

-->

Sails version: 0.12.8
Node version: 7.10.1
NPM version: 3.10.10
DB adapter name: N/A
DB adapter version: N/A
OS Version: Windows 10



The docs for create state that .create() can only create a single record in the database and the arg that is passed to .create() should be a dictionary, however,.create() can take an array. The docs should be updated to indicate .create() can take an array and will create multiple records in the database.

v0.12

All 8 comments

Hi @JasonMFry! It looks like you missed a step or two when you created your issue. Please edit your comment (use the pencil icon at the top-right corner of the comment box) and fix the following:

  • Provide your Operating system

As soon as those items are rectified, post a new comment (e.g. “Ok, fixed!”) below and we'll take a look. Thanks!

*If you feel this message is in error, or you want to debate the merits of my existence (sniffle), please contact [email protected]

Ok, fixed!

Sorry to be a hassle, but it looks like your issue is still missing some required info. Please double-check your initial comment and try again.

*If you feel this message is in error, or you want to debate the merits of my existence (sniffle), please contact [email protected]

Ok, fixed!

Sorry to be a hassle, but it looks like your issue is still missing some required info. Please double-check your initial comment and try again.

*If you feel this message is in error, or you want to debate the merits of my existence (sniffle), please contact [email protected]

Ok, fixed!

Sorry to be a hassle, but it looks like your issue is still missing some required info. Please double-check your initial comment and try again.

*If you feel this message is in error, or you want to debate the merits of my existence (sniffle), please contact [email protected]

@JasonMFry Hi Jason - apologies for the misunderstanding: the docs are incomplete on purpose. In the next major release of Sails, passing an array into .create() _does not work_. Instead, you'll need to use .createEach(), in order to be explicit. In the mean time on v0.12, best practice is to use .create() to create a single record and .createEach() to create multiple records. That way you're future-proofing yourself for the upgrade.

Was this page helpful?
0 / 5 - 0 ratings