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 7534945
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T06:09:47+00:00 2026-05-30T06:09:47+00:00

Whenever I console.log() a Backbone.js Collection, Google Chrome’s console shows the letter d unlike

  • 0

Whenever I console.log() a Backbone.js Collection, Google Chrome’s console shows the letter “d” unlike the typical “Object” log-entry in Safari or Firefox. Is there a difference?

Also, whenever I console.log() any sub-item in a Collection (e.g., console.log(exampleCollection.models)), I get an empty array. Am I doing something wrong?

Code:

(function($) {
  var Item = Backbone.Model.extend({
    defaults: {
      "sku":"",
      "brand":"",
      "model":"",
      "picture":"placeholder.jpg"
    },
    url: function() {
      return this.id ? 'products/' + this.id : 'products';
    }
  });

  var Items = Backbone.Collection.extend({
    model: Item,
    url: "products"
  });

  var items = new Items;

  items.fetch();

  console.log(items); // shows "d" in Google Chrome along with typical 
                      // object-like drop-down options
  console.log(items.models); //  shows "[]" empty array in console

})(jQuery);
  • 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-05-30T06:09:49+00:00Added an answer on May 30, 2026 at 6:09 am

    I’m still new at Backbone but I think Jon Saw is right. All of Backbone’s models, collections, views show up as d and it’s littered all over the minified code. If you see d, it’s a good sign you can manipulate it like Backbone objects can.

    As for the empty array, I’m suspecting that your server side code isn’t returning the collection correctly. Can you post an example of how you’re handling that request and what you’re sending back?

    I think I remember running into a similar problem and the solution was to make sure it’s returning nice json data and that the content-type was application/json. But my memory is hazy.

    EDIT: You might want to play with the success and error callbacks available to fetch(), to shed more light on the situation.

    EDIT2: This past post might be related to your issue – Getting data to and from server with Backbone

    EDIT3: I posted a full backbone example from creating models, adding them to a collection, fetching extra models in the form of a collection from server and adding them to the existing collection (rather than resetting). It has views and subviews mixed in but some of the aspects seemed similar to this question so I am including the reference:

    Keeping track of old part of collection and new part

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

Sidebar

Related Questions

I have a script that notifies the console log whenever a given div is
Whenever I use Console in Chrome's Developer Tools or Firebug to interpret a jQuery
Whenever I place a marker in Google Map using Google API. I want to
I'm using this piece of code from a fellow SO user: $(#rightSubMenu).mousemove(function(e){ console.log('executed'); var
Whenever I close OpenGL window it makes ghci console from which the app was
I wrote a debug macro that prints to the console the passed-in string whenever
http.createServer(function(request, response) { console.log(New request :+request.url); var found = false; for(var i= 0; i
I'm trying to use console.log to put some logging into the javascript side of
Here is an example of what I use: jQuery(document).ready(function() { console.log('scroll'); jQuery(window).scroll(function () {
Whenever I call this method in the Android emulator: SensorManager sensorManager = (SensorManager)getSystemService(Context.SENSOR_SERVICE); The

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.