Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8976119
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T19:03:06+00:00 2026-06-15T19:03:06+00:00

Stumbling around for a few hours now with Sequelize for Node.JS. I had no

  • 0

Stumbling around for a few hours now with Sequelize for Node.JS. I had no such luck using it to set up associations (I’d have to tear apart most of my architecture to do so, on limited time). For my app, there are only a few associations (blog related mostly).

In one of my blog API calls (this is for a specific blog ID):

exports.single = function (req, res, next) {
db.Models.blog.find({
    where: res.locals.where
})
.success(function (blog) {
    getAuthors(blog.BLOG_ID, function (authors) {
        blog.AUTHORS = authors;
        res.locals.data = blog;
        next();
    });
})
.error(function (err) {
    res.locals.error = err;
    next();
});

}

I’m calling getAuthors(blogId) to grab all of the authors in the Author <-> Blog linking table:

function getAuthors (blogId, fn) {
db.Models.author.findAll({
    where: { BLOG_ID: blogId }
})
.success(function (authors) {
    fn(authors);
})
.error (function (err) {
    fn([]);
});

}

It works, mostly. I’m getting the correct data back, but I’m trying to merge that in with the original blog data. Preferably as a property.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T19:03:08+00:00Added an answer on June 15, 2026 at 7:03 pm

    After dumping the contents of my authors object coming back from the second query, I learned of a property used when pulling the data from a Sequelize object

    model.attritubes[];
    

    Is an array of Strings which lists which data attributes will be outputted from the Sequelize Object. So before my line:

    blog.AUTHORS = authors;
    

    I did:

    blog.attributes.splice(5, 0, 'AUTHORS');
    

    I am not a clever man.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Maybe its because I've been coding around two semesters now, but the major stumbling
Now I must admit that I'm stumbling around in the dark a little bit
What are the usual problems / stumbling blocks / issues / drawbacks when using
I am working with System.Func but have reached a stumbling block with it. System.Func<TReturn>
I'm currently getting to grips with mod_rewrite and have ran into a stumbling block
I'm stumbling my way through designing my first Flex app, using Flex Builder 4
I'm very new to using C#. If you have ever heard of the Karol
Django newbie here stumbling my way around the docs. I'm trying to create a
I've been exploring WPF and XAML for a while now, but have hit a
I'm still wrapping my head around DDD, and one of the stumbling blocks I've

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.