
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
waterline-nested
Advanced tools
A simple helper, allows you to do nested creates and updates with Waterline 0.13 (Sails v1.0).
A simple helper, allows you to do nested creates and updates with Waterline 0.13 (Sails v1.0).
npm install waterline-nestedNested.create(model, record)Nested.createEach(model, records)| Argument | Type | Details | |
|---|---|---|---|
| 1 | model | String | A model name. |
| 2 | record | Object | An Object that is to be created. |
| 2 | records | Array | A list of Objects to be created. |
Returns: Promise
// myApp/api/models/User.js
// A user may have many pets
module.exports = {
attributes: {
firstName: {
type: 'string'
},
lastName: {
type: 'string'
},
// Add a reference to Pets
pets: {
collection: 'pet',
via: 'owner'
}
}
};
// myApp/api/models/Pet.js
// A pet may only belong to a single user
module.exports = {
attributes: {
breed: {
type: 'string'
},
type: {
type: 'string'
},
name: {
type: 'string'
},
// Add a reference to User
owner: {
model: 'user'
}
}
};
Now that the pets and users know about each other, they can be associated. To do this we can create or update a pet with the user's object inside.
var Nested = require('waterline-nested');
Nested.create('pet', {
breed: 'labrador',
type: 'dog',
name: 'fido',
owner: { // is User model.
firstName: {
type: 'Dmitry'
},
lastName: {
type: 'Demenchuk'
},
}
}).exec(function(err) {});
It will automativaly create new user and create a pet associated with that user.
waterline-nested with waterline.FAQs
A simple helper, allows you to do nested creates and updates with Waterline 0.13 (Sails v1.0).
The npm package waterline-nested receives a total of 0 weekly downloads. As such, waterline-nested popularity was classified as not popular.
We found that waterline-nested demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.