---
title: Deprecations for Ember Data v2.x
alias: guides/deprecations/
layout: deprecations
---

## Deprecations Added in Ember Data 2.x

### Deprecations Added in Ember Data 2.3

#### Non-primitive defaultValue for Model Attributes

###### until: 3.0.0
###### id: ds.defaultValue.complex-object

Providing a non-primitive value as a `defaultValue` has been deprecated because
the provided value is shared between all instances of the model. Using a
non-primitive value, such as `defaultValue: []`, can lead to unexpected bugs when
that value is mutated.

If you wish to continue using a non-primitive value as the `defaultValue` for an
attribute, you should provide a function that returns the value:

```javascript
import DS from 'ember-data';

export default DS.Model.extend({
  username: DS.attr('string'),
  createdAt: DS.attr('date', {
    defaultValue() {
      return new Date();
    }
  })
});
```

---
title: Deprecations for Ember Data v2.x
alias: guides/deprecations/
layout: deprecations
---

## Deprecations Added in Ember Data 2.x

### Deprecations Added in Ember Data 2.3

#### Non-primitive defaultValue for Model Attributes

###### until: 3.0.0
###### id: ds.defaultValue.complex-object

Providing a non-primitive value as a `defaultValue` has been deprecated because
the provided value is shared between all instances of the model. Using a
non-primitive value, such as `defaultValue: []`, can lead to unexpected bugs when
that value is mutated.

If you wish to continue using a non-primitive value as the `defaultValue` for an
attribute, you should provide a function that returns the value:

```javascript
import DS from 'ember-data';

export default DS.Model.extend({
  username: DS.attr('string'),
  createdAt: DS.attr('date', {
    defaultValue() {
      return new Date();
    }
  })
});
```

### Deprecations Added in Ember Data 2.7

#### Global version of DS

###### until: 3.0.0
###### id: ember-data.global-ds

Using the global version of DS is deprecated. Import `DS` or specific modules from `ember-data` where needed.

For example, if you had:

```javascript
/* globals DS */
```

It would be refactored to:

```javascript
import DS from 'ember-data';
```

Add deprecation for using the global version of DS
Add deprecation for using the global version of DS
