Skip to content

Instantly share code, notes, and snippets.

View akshajmody's full-sized avatar
👁️‍🗨️
Tokyo - NYC

Akshaj Mody akshajmody

👁️‍🗨️
Tokyo - NYC
View GitHub Profile
@akshajmody
akshajmody / mongoqueries.txt
Last active June 1, 2020 20:19
mongoDB queries
QUERY 1
db.products.find({productId: 33324}).explain("executionStats")
"executionTimeMillis" : 8566ms
OUTPUT:
{ "_id" : ObjectId("5ed4e2e9bbec0790d579108c"), "productId" : 33324, "productName" : "Megablock 05 Limited Edition", "price" : 198.99, "reviewCount" : 15, "rating" : 1.25,
"themeName" : "DC Super Heroes", "themeImageUrl" : "https://legofec.s3-us-west-1.amazonaws.com/themes/dc.png",
"featured" : "Hard to find", "chokingHazard" : "true", "productLimit" : 6, "availabilityOnline" : "true" }
QUERY 2
db.availabilities.find({productId: 33324}).explain("executionStats")
@akshajmody
akshajmody / querymetrics.txt
Last active May 29, 2020 20:11
POSTGRES QUERY METRICS
Products Table Query:
SELECT * FROM products where productid = 879569;
(1 row)
Time: 1.960 ms
Product Table Query 2:
SELECT * FROM products where productid > 9999000 AND price > 200.00;
(303 rows)
Time: 4.214 ms
@akshajmody
akshajmody / controller.js
Created May 2, 2020 04:28
Sample API call successfully retrieves all DB data. Next step is retrieving by ID
//ROUTER
const router = require('express').Router();
const controller = require('./controller.js');
router.get('/findAll', controller.get);
module.exports = router;
//CONTROLLER