You might notice that the same query behaves differently in a MongoDB client, like Compass or mongo shell, compared to when using Mongoose within a Node.js application. Below is one such scenario.
[Read More]Clean Up MongoDB Of Old Inactive Users And Their Data With Node Js Script
Reduce Expensive Database Space By Pruning Never-To-Be-Used-Again Data
Databases are not cheap, especially when your application is just taking off and you are low on budget. It is then that freeing up retrievable and precious space from the database is a good way to save some dollars for a while.
[Read More]
Export MongoDB Collection Data In CSV From Node Express Mongoose Application
Suppose a student collection in mongoDB have some data that we want to export in a CSV file from a Mongoose, Node, and Express app. For simplicity, let us assume only two fields in Mongoose schema: lastName and firstName. To export a CSV file, install moment, json2csv, and mongo-date-query (optional) npm packages:
[Read More]
Unit Testing Expressjs Controller (Part 2)
Detailed Example Of Express Mongoose Update API
This is part 2 on the topic of Expressjs controller unit testing. Previously, I added unit tests for 5 basic CRUD APIs for vehicle. In this post I will show one more example, where controller logic gets a little longer.
[Read More]Unit Testing Expressjs Controller (Part 1)
Stepwise Test Driven Development of Express Mongoose CRUD APIs
So far, I have not found a real workable example of unit testing Express controller/route for API. Most I saw either label integration test as unit test or offer little meaningful in right direction.
[Read More]
When you purchase through links on techighness.com, I may earn an affiliate commission.