I am developing a Node.js/Backbone.js SPA and moving some of my data from JSON files to Mongo. I have set up an api with Mongoose and my data is posting to the server. However, when I try to fetch the data from Mongo it only returns the last item in my collection.
The only change in my Backbone.js code is the url I define in the Backbone Collection.
Old Collection that fetched all JSON data without a problem:
var SupplyCategoriesCollection = Backbone.Collection.extend({
model: SupplyCategory,
url: '/supplies',
});
New Collection only fetches last item in Mongo database
var SupplyCategoriesCollection = Backbone.Collection.extend({
model: SupplyCategory,
url: '/api/products',
});
When I navigate to http://localhost:3000/api/products
I get the exact same data as when I navigate to http://localhost:3000/supplies
.