mschwarzmueller / nodejs-shopping-cart-tutorial

Repository with source code of YouTube series about creating a shopping-cart with nodejs
MIT License
352 stars 311 forks source link

Adding products in database causing issue. #4

Open ghost opened 8 years ago

ghost commented 8 years ago

When I add a new document to the Products collection, it causes this problem in execution

untitled

I found that's about the chunkSize variable in the shopping/routes/index.js file, that variable must contain exactly the number of products saved in the database, so to keep my app executable, I must manually change the value of chunkSize and every single n equal to that variable (also equal to number of documents in Products collection) after insertion of new product(s), or I can count the number of the docs in that collection with a mongoDB count methods, but this issue is also related to pagination which is not covered in the tutorial, so basically, if I solved the issue of the execution error, I will have another problem, for example if I have 1000 products in the database, they will be shown in a single page, which is inconvenient.