不要怂,就是干,撸起袖子干!

Commit 3f00865f by Ruben Bridgewater

Docs: replace .values with .get({plain: true})

1 parent 81c8b330
......@@ -277,7 +277,9 @@ sequelize.Promise.all([
// Get the association
return source.getTarget();
}).then(function(_target) {
console.log(_target.values)
console.log(_target.get({
plain: true
}))
/*
{
id: 1,
......
......@@ -68,7 +68,9 @@ It is also possible to define which attributes can be set via the create method&
```js
User.create({ username: 'barfooz', isAdmin: true }, [ 'username' ]).then(function(user) {
// let's assume the default of isAdmin is false:
console.log(user.values) // => { username: 'barfooz', isAdmin: false }
console.log(user.get({
plain: true
})) // => { username: 'barfooz', isAdmin: false }
})
```
......@@ -241,14 +243,16 @@ Tasks.bulkCreate([
## Values of an instance
If you log an instance you will notice, that there is a lot of additional stuff. In order to hide such stuff and reduce it to the very interesting information, you can use the`values`-attribute. Calling it will return only the values of an instance.
If you log an instance you will notice, that there is a lot of additional stuff. In order to hide such stuff and reduce it to the very interesting information, you can use the`get`-attribute. Calling it with the option `plain` = true will only return the values of an instance.
```js
Person.create({
name: 'Rambow',
firstname: 'John'
}).then(function(john) {
console.log(john.values)
console.log(john.get({
plain: true
}))
})
 
// result:
......
......@@ -579,7 +579,9 @@ Let's assume we have an empty database with a `User` model which has a `username
User
.findOrCreate({where: {username: 'sdepold'}, defaults: {job: 'Technical Lead JavaScript'}})
.spread(function(user, created) {
console.log(user.values)
console.log(user.get({
plain: true
}))
console.log(created)
/*
......@@ -603,7 +605,9 @@ User
User
.findOrCreate({where: {username: 'fnord'}, defaults: {job: 'something else'}})
.spread(function(user, created) {
console.log(user.values)
console.log(user.get({
plain: true
}))
console.log(created)
/*
......
......@@ -26,6 +26,8 @@ return sequelize.sync().then(function() {
birthday: new Date(1980, 06, 20)
});
}).then(function(jane) {
console.log(jane.values)
console.log(jane.get({
plain: true
}))
});
```
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!