Skip to content

Instantly share code, notes, and snippets.

@akshajmody
Last active June 1, 2020 20:19
Show Gist options
  • Save akshajmody/0aea2517be41813c1670d29c8d18c0c6 to your computer and use it in GitHub Desktop.
Save akshajmody/0aea2517be41813c1670d29c8d18c0c6 to your computer and use it in GitHub Desktop.
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")
"executionTimeMillis" : 48450ms
"executionTimeMillis" : 49100ms
QUERY 3
db.availabilities.find({productId: 33324, storeId: 332}).explain("executionStats")
"executionTimeMillis" : 49344ms
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment