js-data

Respect Your Data

Give your data the treatment it deserves with a framework-agnostic, datastore-agnostic JavaScript ORM built for ease of use and peace of mind. Works in Node.js and in the Browser.

Get Started

DS#createInstance

DS#createInstance(resourceName, attrs[, options])

Return a new instance of the specified resource.

👍

You can call DS#createInstance multiple ways

  • DS#createInstance(resourceName, attrs[, options])
  • Resource#createInstance(attrs[, options]) - Where Resource was created by DS#defineResource

Argument

Type

Description

resourceName

string

The name of the resource to use. Unnecessary if calling createInstance directly on a Resource.

attrs

object

Properties with which to initialize the instance. Optional.

options

object

Optional configuration. Default: { }

Demo

📘

Need help?

Want more examples or have a question? Ask on the Slack channel or post on the mailing list then we'll get your question answered and probably update this wiki.

Updated 2 years ago

DS#createInstance


DS#createInstance(resourceName, attrs[, options])

Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.