Schema
stringclasses
10 values
prompts
stringlengths
18
200
query
stringlengths
27
751
conversations
listlengths
2
2
{ "database": { "name": "devops_log_event_db", "collections": [ { "name": "applications", "fields": { "_id": "ObjectId", "app_id": "String", "name": "String", "description": "S...
Gets the latest 50 logs from a specific host.
db.logs.find({ host: "server-01" }).sort({ timestamp: -1 }).limit(50);
[ { "from": "human", "value": "Here is mongodb schema {\"database\": {\"name\": \"devops_log_event_db\", \"collections\": [{\"name\": \"applications\", \"fields\": {\"_id\": \"ObjectId\", \"app_id\": \"String\", \"name\": \"String\", \"description\": \"String\", \"environment\": \"String\", \"owner\": \"Strin...
{ "database": { "name": "smartcity_iot_db", "collections": [ { "name": "sensors", "fields": { "_id": "ObjectId", "sensor_id": "String", "type": "String", "location": { ...
wanna find out which sensors have the most frequent maintenance logs, right?
db.maintenance_logs.aggregate([ { $group: { _id: "$sensor_id", maintenanceCount: { $sum: 1 } } }, { $sort: { maintenanceCount: -1 } }, { $limit: 10 } ]);
[ { "from": "human", "value": "Here is mongodb schema {\"database\": {\"name\": \"smartcity_iot_db\", \"collections\": [{\"name\": \"sensors\", \"fields\": {\"_id\": \"ObjectId\", \"sensor_id\": \"String\", \"type\": \"String\", \"location\": {\"latitude\": \"Double\", \"longitude\": \"Double\", \"address\": ...
{ "database": { "name": "logistics_supply_chain_db", "collections": [ { "name": "shipments", "fields": { "_id": "ObjectId", "shipmentNumber": "String", "origin": { "warehouseId": "ObjectId", "address": "String", "departure...
find out the top 10 most shipped products by aggregating the shipment data.
db.shipments.aggregate([{ "$unwind": "$items" }, { "$group": { "_id": "$items.productId", "totalQuantity": { "$sum": "$items.quantity" } } }, { "$sort": { "totalQuantity": -1 } }, { "$limit": 10 }])
[ { "from": "human", "value": "Here is mongodb schema {\"database\": {\"name\": \"logistics_supply_chain_db\", \"collections\": [{\"name\": \"shipments\", \"fields\": {\"_id\": \"ObjectId\", \"shipmentNumber\": \"String\", \"origin\": {\"warehouseId\": \"ObjectId\", \"address\": \"String\", \"departureTime\":...
{ "database": { "name": "logistics_supply_chain_db", "collections": [ { "name": "shipments", "fields": { "_id": "ObjectId", "shipmentNumber": "String", "origin": { "warehouseId": "ObjectId", "address": "String", "departure...
calculate Average Shipment Duration
db.shipments.aggregate([ { "$match": { "destination.arrivalTime": { "$exists": true } } }, { "$project": { "duration": { "$subtract": ["$destination.arrivalTime", "$origin.departureTime"] } } }, { "$group": { "_id": null, "avgDuration": { "$avg": "$duration" } } } ])
[ { "from": "human", "value": "Here is mongodb schema {\"database\": {\"name\": \"logistics_supply_chain_db\", \"collections\": [{\"name\": \"shipments\", \"fields\": {\"_id\": \"ObjectId\", \"shipmentNumber\": \"String\", \"origin\": {\"warehouseId\": \"ObjectId\", \"address\": \"String\", \"departureTime\":...
{ "database": { "name": "genomic_analysis_healthcare_db", "collections": [ { "name": "patients", "fields": { "_id": "ObjectId", "patient_id": "String", "first_name": "String", ...
So, what are the most common actions that people do in the system?
db.audit_logs.aggregate([ { "$group": { "_id": "$action", "count": { "$sum": 1 } } }, { "$sort": { "count": -1 } } ])
[ { "from": "human", "value": "Here is mongodb schema {\"database\": {\"name\": \"genomic_analysis_healthcare_db\", \"collections\": [{\"name\": \"patients\", \"fields\": {\"_id\": \"ObjectId\", \"patient_id\": \"String\", \"first_name\": \"String\", \"last_name\": \"String\", \"gender\": \"String\", \"date_o...
{ "database": { "name": "social_sentiment_analysis_db", "collections": [ { "name": "social_posts", "fields": { "_id": "ObjectId", "post_id": "String", "platform": "String", "us...
Show me influencers with the most recent activity.
db.influencers.find().sort({ "last_active": -1 }).limit(10)
[ { "from": "human", "value": "Here is mongodb schema {\"database\": {\"name\": \"social_sentiment_analysis_db\", \"collections\": [{\"name\": \"social_posts\", \"fields\": {\"_id\": \"ObjectId\", \"post_id\": \"String\", \"platform\": \"String\", \"user\": {\"user_id\": \"String\", \"username\": \"String\", ...
{ "database": { "name": "social_sentiment_analysis_db", "collections": [ { "name": "social_posts", "fields": { "_id": "ObjectId", "post_id": "String", "platform": "String", "us...
how to track the average sentiment score trend by month and year for comments made by a specific influencer on a platform?
db.comments.aggregate([ { "$match": { "user.user_id": "<specific_user_id>" } }, { "$group": { "_id": { "year": { "$year": "$created_at_platform" }, "month": { "$month": "$created_at_platform" } }, "avg_sentiment": { "$avg": "$sentiment_score" } } }, { "$sort": { "_id.year": 1, "_id.month": 1 } } ])
[ { "from": "human", "value": "Here is mongodb schema {\"database\": {\"name\": \"social_sentiment_analysis_db\", \"collections\": [{\"name\": \"social_posts\", \"fields\": {\"_id\": \"ObjectId\", \"post_id\": \"String\", \"platform\": \"String\", \"user\": {\"user_id\": \"String\", \"username\": \"String\", ...
{ "database": { "name": "customer360_retail_db", "collections": [ { "name": "customers", "fields": { "_id": "ObjectId", "customer_id": "String", "first_name": "String", "last_n...
Find customers who have made only one purchase vs. those who have made multiple.
db.transactions.aggregate([ { $group: { _id: "$customer_id", purchase_count: { $sum: 1 } } }, { $group: { _id: { $cond: { if: { $eq: ["$purchase_count", 1] }, then: "One-Time Customers", else: "Repeat Customers" } }, count: { $sum: 1 } } } ])
[ { "from": "human", "value": "Here is mongodb schema {\"database\": {\"name\": \"customer360_retail_db\", \"collections\": [{\"name\": \"customers\", \"fields\": {\"_id\": \"ObjectId\", \"customer_id\": \"String\", \"first_name\": \"String\", \"last_name\": \"String\", \"email\": \"String\", \"phone\": \"Str...
{ "database": "RealTimeUserAnalytics", "collections": { "users": { "indexes": [ {"userId": 1, "unique": true}, {"email": 1, "unique": true} ], "schema": { "userId": "ObjectId", "email": "string", "username": "string", "firstName": "string", ...
Can you find out which top 10 products have been getting a lot of attention in the last 24 hours?
db.events.aggregate([ { $match: { timestamp: { $gte: new Date(Date.now() - 24 * 60 * 60 * 1000) } } }, { $group: { _id: "$productId", interactions: { $sum: 1 } } }, { $sort: { interactions: -1 } }, { $limit: 10 } ]);
[ { "from": "human", "value": "Here is mongodb schema {\"database\": \"RealTimeUserAnalytics\", \"collections\": {\"users\": {\"indexes\": [{\"userId\": 1, \"unique\": true}, {\"email\": 1, \"unique\": true}], \"schema\": {\"userId\": \"ObjectId\", \"email\": \"string\", \"username\": \"string\", \"firstName\...
{ "database": { "name": "customer360_retail_db", "collections": [ { "name": "customers", "fields": { "_id": "ObjectId", "customer_id": "String", "first_name": "String", "last_n...
Can you tell me which customer segment brings in the most money based on the transactions data?
db.transactions.aggregate([ { $lookup: { from: "customers", localField: "customer_id", foreignField: "customer_id", as: "customer" } }, { $unwind: "$customer" }, { $group: { _id: "$customer.customer_segment", total_revenue: { $sum: "$total_amount" } } }, {...
[ { "from": "human", "value": "Here is mongodb schema {\"database\": {\"name\": \"customer360_retail_db\", \"collections\": [{\"name\": \"customers\", \"fields\": {\"_id\": \"ObjectId\", \"customer_id\": \"String\", \"first_name\": \"String\", \"last_name\": \"String\", \"email\": \"String\", \"phone\": \"Str...
{ "database": { "name": "recommendation_system",{ "collections": [ { "name": "users", "fields": { "_id": "ObjectId", "name": "string", "email": "string", "password": "string", "preferences": { "genres": ["string"], "languages": ["string...
Could you tell me how many total interactions are there in the user interactions database?
db.user_interactions.countDocuments({})
[ { "from": "human", "value": "Here is mongodb schema and Could you tell me how many total interactions are there in the user interactions database?" }, { "from": "gpt", "value": "db.user_interactions.countDocuments({})" } ]
{ "database": { "name": "devops_log_event_db", "collections": [ { "name": "applications", "fields": { "_id": "ObjectId", "app_id": "String", "name": "String", "description": "S...
Hey, can you tell me how to find cloud resources that cost more than $1000 in a billing cycle?
db.cloud_resource_usage.find({ cost: { $gte: 1000 } }).sort({ billing_cycle: -1 });
[ { "from": "human", "value": "Here is mongodb schema {\"database\": {\"name\": \"devops_log_event_db\", \"collections\": [{\"name\": \"applications\", \"fields\": {\"_id\": \"ObjectId\", \"app_id\": \"String\", \"name\": \"String\", \"description\": \"String\", \"environment\": \"String\", \"owner\": \"Strin...
{ "database": "RealTimeUserAnalytics", "collections": { "users": { "indexes": [ {"userId": 1, "unique": true}, {"email": 1, "unique": true} ], "schema": { "userId": "ObjectId", "email": "string", "username": "string", "firstName": "string", ...
Can you show me where users are dropping off in the purchase process by counting the number of views, clicks, wishlists, and purchases for each user?
db.events.aggregate([ { $match: { eventType: { $in: ["view", "click", "wishlist", "purchase"] } } }, { $group: { _id: "$userId", views: { $sum: { $cond: [{ $eq: ["$eventType", "view"] }, 1, 0] } }, clicks: { $sum: { $cond: [{ $eq: ["$eventType", "click"] }, 1, 0] } }, ...
[ { "from": "human", "value": "Here is mongodb schema {\"database\": \"RealTimeUserAnalytics\", \"collections\": {\"users\": {\"indexes\": [{\"userId\": 1, \"unique\": true}, {\"email\": 1, \"unique\": true}], \"schema\": {\"userId\": \"ObjectId\", \"email\": \"string\", \"username\": \"string\", \"firstName\...
{ "database": { "name": "recommendation_system",{ "collections": [ { "name": "users", "fields": { "_id": "ObjectId", "name": "string", "email": "string", "password": "string", "preferences": { "genres": ["string"], "languages": ["string...
Can you please show me the top 5 most viewed content?
db.user_interactions.aggregate([{ $match: { interactionType: "view" } }, { $group: { _id: "$contentId", count: { $sum: 1 } } }, { $sort: { count: -1 } }, { $limit: 5 }])
[ { "from": "human", "value": "Here is mongodb schema and Can you please show me the top 5 most viewed content?" }, { "from": "gpt", "value": "db.user_interactions.aggregate([{$match: {interactionType: \"view\"}}, {$group: {_id: \"$contentId\", count: {$sum: 1}}}, {$sort: {count: -1}}, {$limit: ...
{ "database": { "name": "customer360_retail_db", "collections": [ { "name": "customers", "fields": { "_id": "ObjectId", "customer_id": "String", "first_name": "String", "last_n...
Find the conversion rate of customers targeted in a campaign.
db.marketing_campaigns.aggregate([ { $lookup: { from: "transactions", localField: "segment_targets", foreignField: "customer_id", as: "purchases" } }, { $project: { name: 1, conversion_rate: { $divide: [{ $size: "$purchases" }, { $size: "$segment_targets" }]...
[ { "from": "human", "value": "Here is mongodb schema {\"database\": {\"name\": \"customer360_retail_db\", \"collections\": [{\"name\": \"customers\", \"fields\": {\"_id\": \"ObjectId\", \"customer_id\": \"String\", \"first_name\": \"String\", \"last_name\": \"String\", \"email\": \"String\", \"phone\": \"Str...
{ "database": { "name": "devops_log_event_db", "collections": [ { "name": "applications", "fields": { "_id": "ObjectId", "app_id": "String", "name": "String", "description": "S...
Finds all anomalies where the anomaly score is above 0.8.
db.anomaly_detection_results.find({ anomaly_score: { $gte: 0.8 } }).sort({ timestamp: -1 });
[ { "from": "human", "value": "Here is mongodb schema {\"database\": {\"name\": \"devops_log_event_db\", \"collections\": [{\"name\": \"applications\", \"fields\": {\"_id\": \"ObjectId\", \"app_id\": \"String\", \"name\": \"String\", \"description\": \"String\", \"environment\": \"String\", \"owner\": \"Strin...
{ "database": { "name": "logistics_supply_chain_db", "collections": [ { "name": "shipments", "fields": { "_id": "ObjectId", "shipmentNumber": "String", "origin": { "warehouseId": "ObjectId", "address": "String", "departure...
Can you determine which five vehicles have been used the most often, along with how many times each one has been used?
db.vehicles.aggregate([{ "$lookup": { "from": "shipments", "localField": "_id", "foreignField": "assignedVehicleId", "as": "shipments" } }, { "$project": { "vehicleNumber": 1, "shipmentCount": { "$size": "$shipments" } } }, { "$sort": { "shipmentCount": -1 } }, { "$limit": 5 }])
[ { "from": "human", "value": "Here is mongodb schema {\"database\": {\"name\": \"logistics_supply_chain_db\", \"collections\": [{\"name\": \"shipments\", \"fields\": {\"_id\": \"ObjectId\", \"shipmentNumber\": \"String\", \"origin\": {\"warehouseId\": \"ObjectId\", \"address\": \"String\", \"departureTime\":...
{ "database": "RealTimeUserAnalytics", "collections": { "users": { "indexes": [ {"userId": 1, "unique": true}, {"email": 1, "unique": true} ], "schema": { "userId": "ObjectId", "email": "string", "username": "string", "firstName": "string", ...
Can you please identify the top-performing products by counting the number of views, clicks, and purchases for each product in the database?
db.events.aggregate([ { $group: { _id: "$productId", views: { $sum: { $cond: [{ $eq: ["$eventType", "view"] }, 1, 0] } }, clicks: { $sum: { $cond: [{ $eq: ["$eventType", "click"] }, 1, 0] } }, purchases: { $sum: { $cond: [{ $eq: ["$eventType", "purchase"] }, 1, 0] }...
[ { "from": "human", "value": "Here is mongodb schema {\"database\": \"RealTimeUserAnalytics\", \"collections\": {\"users\": {\"indexes\": [{\"userId\": 1, \"unique\": true}, {\"email\": 1, \"unique\": true}], \"schema\": {\"userId\": \"ObjectId\", \"email\": \"string\", \"username\": \"string\", \"firstName\...
{ "database": { "name": "recommendation_system",{ "collections": [ { "name": "users", "fields": { "_id": "ObjectId", "name": "string", "email": "string", "password": "string", "preferences": { "genres": ["string"], "languages": ["string...
find out the total number of documents stored in the 'users' collection in database?
db.users.countDocuments({})
[ { "from": "human", "value": "Here is mongodb schema and find out the total number of documents stored in the 'users' collection in database?" }, { "from": "gpt", "value": "db.users.countDocuments({})" } ]
{ "database": { "name": "stock_market_db",{ "collections": [ { "name": "stocks", "fields": { "_id": "ObjectId", "ticker": "string", "companyName": "string", "sector": "string", "industry": "string", "market": "string", "createdAt": "date", ...
Can you find the daily percentage change in price for a specific stock, where we have each record of the stock's open and close prices sorted by date?
db.price_history.aggregate([{ $match: { stockId: ObjectId("STOCK_ID") } }, { $sort: { date: 1 } }, { $group: { _id: "$date", priceChange: { $subtract: ["$close", "$open"] } } }])
[ { "from": "human", "value": "Here is mongodb schema and Can you find the daily percentage change in price for a specific stock, where we have each record of the stock's open and close prices sorted by date?" }, { "from": "gpt", "value": "db.price_history.aggregate([{$match: {stockId: ObjectId(...
{ "database": { "name": "fraud_detection_db", "collections": [ { "name": "customers", "fields": { "_id": "ObjectId", "customer_id": "String", "name": "String", "email": "String...
Find the count of fraud alerts based on severity.
db.fraud_alerts.aggregate([ { $group: { _id: "$severity", count: { $sum: 1 } } }, { $sort: { count: -1 } } ])
[ { "from": "human", "value": "Here is mongodb schema {\"database\": {\"name\": \"fraud_detection_db\", \"collections\": [{\"name\": \"customers\", \"fields\": {\"_id\": \"ObjectId\", \"customer_id\": \"String\", \"name\": \"String\", \"email\": \"String\", \"phone\": \"String\", \"address\": {\"street\": \"S...
{ "database": { "name": "devops_log_event_db", "collections": [ { "name": "applications", "fields": { "_id": "ObjectId", "app_id": "String", "name": "String", "description": "S...
Finds users with the highest number of changes (audit logs).
db.audit_trails.aggregate([ { $group: { _id: "$performed_by", changes_made: { $sum: 1 } } }, { $sort: { changes_made: -1 } }, { $limit: 10 } ]);
[ { "from": "human", "value": "Here is mongodb schema {\"database\": {\"name\": \"devops_log_event_db\", \"collections\": [{\"name\": \"applications\", \"fields\": {\"_id\": \"ObjectId\", \"app_id\": \"String\", \"name\": \"String\", \"description\": \"String\", \"environment\": \"String\", \"owner\": \"Strin...
{ "database": { "name": "stock_market_db",{ "collections": [ { "name": "stocks", "fields": { "_id": "ObjectId", "ticker": "string", "companyName": "string", "sector": "string", "industry": "string", "market": "string", "createdAt": "date", ...
Which stocks had the highest adjusted close prices in the last month?
db.price_history.aggregate([{ $match: { date: { $gte: new ISODate("START_DATE") } } }, { $group: { _id: "$stockId", maxAdjClose: { $max: "$adjustedClose" } } }, { $sort: { maxAdjClose: -1 } }, { $limit: 10 }])
[ { "from": "human", "value": "Here is mongodb schema and Which stocks had the highest adjusted close prices in the last month?" }, { "from": "gpt", "value": "db.price_history.aggregate([{$match: {date: {$gte: new ISODate(\"START_DATE\")}}}, {$group: {_id: \"$stockId\", maxAdjClose: {$max: \"$ad...
{ "database": { "name": "recommendation_system",{ "collections": [ { "name": "users", "fields": { "_id": "ObjectId", "name": "string", "email": "string", "password": "string", "preferences": { "genres": ["string"], "languages": ["string...
Can you find users who have viewed or liked content but haven't rated any content?
db.user_interactions.aggregate([{ $match: { interactionType: { $in: ["view", "like"] } } }, { $group: { _id: "$userId", rated: { $addToSet: "$contentId" } } }, { $lookup: { from: "user_interactions", localField: "_id", foreignField: "userId", as: "ratings", pipeline: [{ $match: { interactionType: "rating" } }, { $group...
[ { "from": "human", "value": "Here is mongodb schema and Can you find users who have viewed or liked content but haven't rated any content?" }, { "from": "gpt", "value": "db.user_interactions.aggregate([{$match: {interactionType: {$in: [\"view\", \"like\"]}}}, {$group: {_id: \"$userId\", rated...
{ "database": { "name": "customer360_retail_db", "collections": [ { "name": "customers", "fields": { "_id": "ObjectId", "customer_id": "String", "first_name": "String", "last_n...
Find customers who haven't redeemed loyalty points in the last 6 months.
db.loyalty_program.aggregate([ { $match: { last_activity_date: { $lt: new Date(new Date().setMonth(new Date().getMonth() - 6)) } } } ])
[ { "from": "human", "value": "Here is mongodb schema {\"database\": {\"name\": \"customer360_retail_db\", \"collections\": [{\"name\": \"customers\", \"fields\": {\"_id\": \"ObjectId\", \"customer_id\": \"String\", \"first_name\": \"String\", \"last_name\": \"String\", \"email\": \"String\", \"phone\": \"Str...
{ "database": { "name": "logistics_supply_chain_db", "collections": [ { "name": "shipments", "fields": { "_id": "ObjectId", "shipmentNumber": "String", "origin": { "warehouseId": "ObjectId", "address": "String", "departure...
What's the longest shipment distance you have, sorted from highest to lowest?
db.routes.aggregate([{ "$sort": { "distanceInKm": -1 } }, { "$limit": 1 }])
[ { "from": "human", "value": "Here is mongodb schema {\"database\": {\"name\": \"logistics_supply_chain_db\", \"collections\": [{\"name\": \"shipments\", \"fields\": {\"_id\": \"ObjectId\", \"shipmentNumber\": \"String\", \"origin\": {\"warehouseId\": \"ObjectId\", \"address\": \"String\", \"departureTime\":...
{ "database": { "name": "genomic_analysis_healthcare_db", "collections": [ { "name": "patients", "fields": { "_id": "ObjectId", "patient_id": "String", "first_name": "String", ...
Who are the top 10 researchers with the most studies in the clinical studies database?
db.clinical_studies.aggregate([ { "$group": { "_id": "$researcher", "count": { "$sum": 1 } } }, { "$sort": { "count": -1 } }, { "$limit": 10 } ])
[ { "from": "human", "value": "Here is mongodb schema {\"database\": {\"name\": \"genomic_analysis_healthcare_db\", \"collections\": [{\"name\": \"patients\", \"fields\": {\"_id\": \"ObjectId\", \"patient_id\": \"String\", \"first_name\": \"String\", \"last_name\": \"String\", \"gender\": \"String\", \"date_o...
{ "database": { "name": "logistics_supply_chain_db", "collections": [ { "name": "shipments", "fields": { "_id": "ObjectId", "shipmentNumber": "String", "origin": { "warehouseId": "ObjectId", "address": "String", "departure...
Can you tell me how many shipments are coming from each warehouse?
db.shipments.aggregate([ { "$group": { "_id": "$origin.warehouseId", "count": { "$sum": 1 } } } ])
[ { "from": "human", "value": "Here is mongodb schema {\"database\": {\"name\": \"logistics_supply_chain_db\", \"collections\": [{\"name\": \"shipments\", \"fields\": {\"_id\": \"ObjectId\", \"shipmentNumber\": \"String\", \"origin\": {\"warehouseId\": \"ObjectId\", \"address\": \"String\", \"departureTime\":...
{ "database": { "name": "genomic_analysis_healthcare_db", "collections": [ { "name": "patients", "fields": { "_id": "ObjectId", "patient_id": "String", "first_name": "String", ...
Can you help me find out which permissions are most commonly assigned to users in our system?
db.users.aggregate([ { "$unwind": "$permissions" }, { "$group": { "_id": "$permissions", "count": { "$sum": 1 } } }, { "$sort": { "count": -1 } } ])
[ { "from": "human", "value": "Here is mongodb schema {\"database\": {\"name\": \"genomic_analysis_healthcare_db\", \"collections\": [{\"name\": \"patients\", \"fields\": {\"_id\": \"ObjectId\", \"patient_id\": \"String\", \"first_name\": \"String\", \"last_name\": \"String\", \"gender\": \"String\", \"date_o...
{ "database": { "name": "genomic_analysis_healthcare_db", "collections": [ { "name": "patients", "fields": { "_id": "ObjectId", "patient_id": "String", "first_name": "String", ...
find out which genes appear most frequently in our database of genetic variants, specifically listing the top ten?
db.variants.aggregate([ { "$group": { "_id": "$gene", "count": { "$sum": 1 } } }, { "$sort": { "count": -1 } }, { "$limit": 10 } ])
[ { "from": "human", "value": "Here is mongodb schema {\"database\": {\"name\": \"genomic_analysis_healthcare_db\", \"collections\": [{\"name\": \"patients\", \"fields\": {\"_id\": \"ObjectId\", \"patient_id\": \"String\", \"first_name\": \"String\", \"last_name\": \"String\", \"gender\": \"String\", \"date_o...
{ "database": { "name": "stock_market_db",{ "collections": [ { "name": "stocks", "fields": { "_id": "ObjectId", "ticker": "string", "companyName": "string", "sector": "string", "industry": "string", "market": "string", "createdAt": "date", ...
Can you tell me how many alerts were triggered in the last 7 days?
db.alerts.aggregate([{ $match: { isTriggered: true, triggeredAt: { $gte: new ISODate("START_DATE") } } }, { $count: "totalAlertsTriggered" }])
[ { "from": "human", "value": "Here is mongodb schema and Can you tell me how many alerts were triggered in the last 7 days?" }, { "from": "gpt", "value": "db.alerts.aggregate([{$match: {isTriggered: true, triggeredAt: {$gte: new ISODate(\"START_DATE\")}}}, {$count: \"totalAlertsTriggered\"}])" ...
{ "database": "RealTimeUserAnalytics", "collections": { "users": { "indexes": [ {"userId": 1, "unique": true}, {"email": 1, "unique": true} ], "schema": { "userId": "ObjectId", "email": "string", "username": "string", "firstName": "string", ...
find users who are performing actions at an unusually high rate, more than 100 actions per minute?
db.events.aggregate([ { $group: { _id: "$userId", actionsPerMinute: { $avg: { $divide: [ { $subtract: [ "$timestamp", new Date() ] }, 60000 ] } } } }, { $match: { actionsPerMinute: { $gt: 100 } } } ]);
[ { "from": "human", "value": "Here is mongodb schema {\"database\": \"RealTimeUserAnalytics\", \"collections\": {\"users\": {\"indexes\": [{\"userId\": 1, \"unique\": true}, {\"email\": 1, \"unique\": true}], \"schema\": {\"userId\": \"ObjectId\", \"email\": \"string\", \"username\": \"string\", \"firstName\...
{ "database": { "name": "social_sentiment_analysis_db", "collections": [ { "name": "social_posts", "fields": { "_id": "ObjectId", "post_id": "String", "platform": "String", "us...
Can you tell me who the top 10 users with the most comments are in our system?
db.comments.aggregate([ { "$group": { "_id": "$user.user_id", "total_comments": { "$sum": 1 } } }, { "$sort": { "total_comments": -1 } }, { "$limit": 10 } ])
[ { "from": "human", "value": "Here is mongodb schema {\"database\": {\"name\": \"social_sentiment_analysis_db\", \"collections\": [{\"name\": \"social_posts\", \"fields\": {\"_id\": \"ObjectId\", \"post_id\": \"String\", \"platform\": \"String\", \"user\": {\"user_id\": \"String\", \"username\": \"String\", ...
{ "database": { "name": "customer360_retail_db", "collections": [ { "name": "customers", "fields": { "_id": "ObjectId", "customer_id": "String", "first_name": "String", "last_n...
Find the top 10 products generating the highest sales revenue.
db.transactions.aggregate([ { $unwind: "$items_purchased" }, { $group: { _id: "$items_purchased.product_id", product_name: { $first: "$items_purchased.product_name" }, total_revenue: { $sum: { $multiply: ["$items_purchased.quantity", "$items_purchased.price"] } } } }, { $sort: { total_...
[ { "from": "human", "value": "Here is mongodb schema {\"database\": {\"name\": \"customer360_retail_db\", \"collections\": [{\"name\": \"customers\", \"fields\": {\"_id\": \"ObjectId\", \"customer_id\": \"String\", \"first_name\": \"String\", \"last_name\": \"String\", \"email\": \"String\", \"phone\": \"Str...
{ "database": "RealTimeUserAnalytics", "collections": { "users": { "indexes": [ {"userId": 1, "unique": true}, {"email": 1, "unique": true} ], "schema": { "userId": "ObjectId", "email": "string", "username": "string", "firstName": "string", ...
Can find out which products are popular in different locations?
db.events.aggregate([ { $group: { _id: "$eventMetadata.location", productInteractions: { $push: "$productId" } } } ]);
[ { "from": "human", "value": "Here is mongodb schema {\"database\": \"RealTimeUserAnalytics\", \"collections\": {\"users\": {\"indexes\": [{\"userId\": 1, \"unique\": true}, {\"email\": 1, \"unique\": true}], \"schema\": {\"userId\": \"ObjectId\", \"email\": \"string\", \"username\": \"string\", \"firstName\...
{ "database": { "name": "recommendation_system",{ "collections": [ { "name": "users", "fields": { "_id": "ObjectId", "name": "string", "email": "string", "password": "string", "preferences": { "genres": ["string"], "languages": ["string...
Can you tell me which content item is the most added to wishlists by your users?
db.user_interactions.aggregate([{ $match: { interactionType: "wishlist" } }, { $group: { _id: "$contentId", count: { $sum: 1 } } }, { $sort: { count: -1 } }, { $limit: 1 }])
[ { "from": "human", "value": "Here is mongodb schema and Can you tell me which content item is the most added to wishlists by your users?" }, { "from": "gpt", "value": "db.user_interactions.aggregate([{$match: {interactionType: \"wishlist\"}}, {$group: {_id: \"$contentId\", count: {$sum: 1}}}, ...
{ "database": { "name": "fraud_detection_db", "collections": [ { "name": "customers", "fields": { "_id": "ObjectId", "customer_id": "String", "name": "String", "email": "String...
Find customers with the highest risk scores.
db.behavior_profiles.find({}, { customer_id: 1, risk_score: 1 }).sort({ risk_score: -1 }).limit(10)
[ { "from": "human", "value": "Here is mongodb schema {\"database\": {\"name\": \"fraud_detection_db\", \"collections\": [{\"name\": \"customers\", \"fields\": {\"_id\": \"ObjectId\", \"customer_id\": \"String\", \"name\": \"String\", \"email\": \"String\", \"phone\": \"String\", \"address\": {\"street\": \"S...
{ "database": { "name": "recommendation_system",{ "collections": [ { "name": "users", "fields": { "_id": "ObjectId", "name": "string", "email": "string", "password": "string", "preferences": { "genres": ["string"], "languages": ["string...
Can you find out which user has rated the most content?
db.user_interactions.aggregate([{ $match: { interactionType: "rating" } }, { $group: { _id: "$userId", count: { $sum: 1 } } }, { $sort: { count: -1 } }, { $limit: 1 }])
[ { "from": "human", "value": "Here is mongodb schema and Can you find out which user has rated the most content?" }, { "from": "gpt", "value": "db.user_interactions.aggregate([{$match: {interactionType: \"rating\"}}, {$group: {_id: \"$userId\", count: {$sum: 1}}}, {$sort: {count: -1}}, {$limit:...
{ "database": { "name": "smartcity_iot_db", "collections": [ { "name": "sensors", "fields": { "_id": "ObjectId", "sensor_id": "String", "type": "String", "location": { ...
can you Monitor AQI and pollution levels over time.?
db.sensor_data.aggregate([ { $match: { "data.air_quality.AQI": { $exists: true } } }, { $group: { _id: { date: { $dateToString: { format: "%Y-%m-%d", date: "$timestamp" } } }, avgAQI: { $avg: "$data.air_quality.AQI" } } }, { $sort: { "_id.date": 1 } } ]);
[ { "from": "human", "value": "Here is mongodb schema {\"database\": {\"name\": \"smartcity_iot_db\", \"collections\": [{\"name\": \"sensors\", \"fields\": {\"_id\": \"ObjectId\", \"sensor_id\": \"String\", \"type\": \"String\", \"location\": {\"latitude\": \"Double\", \"longitude\": \"Double\", \"address\": ...
{ "database": { "name": "smartcity_iot_db", "collections": [ { "name": "sensors", "fields": { "_id": "ObjectId", "sensor_id": "String", "type": "String", "location": { ...
Can you show me how to find out which sensors have been going offline frequently by calculating their offline duration in hours?
db.sensors.aggregate([ { $match: { last_online: { $exists: true } } }, { $project: { sensor_id: 1, downtime_hours: { $divide: [{ $subtract: [new Date(), "$last_online"] }, 3600000] } } }, { $sort: { downtime_hours: -1 } } ]);
[ { "from": "human", "value": "Here is mongodb schema {\"database\": {\"name\": \"smartcity_iot_db\", \"collections\": [{\"name\": \"sensors\", \"fields\": {\"_id\": \"ObjectId\", \"sensor_id\": \"String\", \"type\": \"String\", \"location\": {\"latitude\": \"Double\", \"longitude\": \"Double\", \"address\": ...
{ "database": { "name": "devops_log_event_db", "collections": [ { "name": "applications", "fields": { "_id": "ObjectId", "app_id": "String", "name": "String", "description": "S...
Lists the top 5 most frequently deployed applications in the last month.
db.deployment_history.aggregate([ { $match: { deployed_at: { $gte: new Date(new Date().setMonth(new Date().getMonth() - 1)) } } }, { $group: { _id: "$app_id", deployments: { $sum: 1 } } }, { $sort: { deployments: -1 } }, { $limit: 5 } ]);
[ { "from": "human", "value": "Here is mongodb schema {\"database\": {\"name\": \"devops_log_event_db\", \"collections\": [{\"name\": \"applications\", \"fields\": {\"_id\": \"ObjectId\", \"app_id\": \"String\", \"name\": \"String\", \"description\": \"String\", \"environment\": \"String\", \"owner\": \"Strin...
{ "database": { "name": "customer360_retail_db", "collections": [ { "name": "customers", "fields": { "_id": "ObjectId", "customer_id": "String", "first_name": "String", "last_n...
Find which marketing channels bring in the most new customers.
db.customers.aggregate([ { $group: { _id: "$opt_in_marketing", new_customers: { $sum: 1 } } }, { $sort: { new_customers: -1 } } ])
[ { "from": "human", "value": "Here is mongodb schema {\"database\": {\"name\": \"customer360_retail_db\", \"collections\": [{\"name\": \"customers\", \"fields\": {\"_id\": \"ObjectId\", \"customer_id\": \"String\", \"first_name\": \"String\", \"last_name\": \"String\", \"email\": \"String\", \"phone\": \"Str...
{ "database": { "name": "genomic_analysis_healthcare_db", "collections": [ { "name": "patients", "fields": { "_id": "ObjectId", "patient_id": "String", "first_name": "String", ...
Hey, can you explain how to find the top 10 most active users by looking at the audit logs in a database?
db.audit_logs.aggregate([ { "$group": { "_id": "$user_id", "count": { "$sum": 1 } } }, { "$sort": { "count": -1 } }, { "$limit": 10 } ])
[ { "from": "human", "value": "Here is mongodb schema {\"database\": {\"name\": \"genomic_analysis_healthcare_db\", \"collections\": [{\"name\": \"patients\", \"fields\": {\"_id\": \"ObjectId\", \"patient_id\": \"String\", \"first_name\": \"String\", \"last_name\": \"String\", \"gender\": \"String\", \"date_o...
{ "database": { "name": "smartcity_iot_db", "collections": [ { "name": "sensors", "fields": { "_id": "ObjectId", "sensor_id": "String", "type": "String", "location": { ...
Can you help me understand the monthly and yearly trends in the installation activities from the sensor data collection?
db.sensors.aggregate([ { $group: { _id: { month: { $month: "$installation_date" }, year: { $year: "$installation_date" } }, installations: { $sum: 1 } } }, { $sort: { "_id.year": 1, "_id.month": 1 } } ]);
[ { "from": "human", "value": "Here is mongodb schema {\"database\": {\"name\": \"smartcity_iot_db\", \"collections\": [{\"name\": \"sensors\", \"fields\": {\"_id\": \"ObjectId\", \"sensor_id\": \"String\", \"type\": \"String\", \"location\": {\"latitude\": \"Double\", \"longitude\": \"Double\", \"address\": ...
{ "database": { "name": "recommendation_system",{ "collections": [ { "name": "users", "fields": { "_id": "ObjectId", "name": "string", "email": "string", "password": "string", "preferences": { "genres": ["string"], "languages": ["string...
Can you show me the top five pieces of content with the highest ratings, just the titles and average ratings?
db.content.find({}, { title: 1, averageRating: 1 }).sort({ averageRating: -1 }).limit(5)
[ { "from": "human", "value": "Here is mongodb schema and Can you show me the top five pieces of content with the highest ratings, just the titles and average ratings?" }, { "from": "gpt", "value": "db.content.find({}, {title: 1, averageRating: 1}).sort({averageRating: -1}).limit(5)" } ]
{ "database": { "name": "fraud_detection_db", "collections": [ { "name": "customers", "fields": { "_id": "ObjectId", "customer_id": "String", "name": "String", "email": "String...
Find fraudulent transactions with an amount above a threshold (e.g., $10,000).
db.transactions.find({ "fraud_flag": true, "amount": { $gt: 10000 } })
[ { "from": "human", "value": "Here is mongodb schema {\"database\": {\"name\": \"fraud_detection_db\", \"collections\": [{\"name\": \"customers\", \"fields\": {\"_id\": \"ObjectId\", \"customer_id\": \"String\", \"name\": \"String\", \"email\": \"String\", \"phone\": \"String\", \"address\": {\"street\": \"S...
{ "database": { "name": "fraud_detection_db", "collections": [ { "name": "customers", "fields": { "_id": "ObjectId", "customer_id": "String", "name": "String", "email": "String...
Analyze transaction trends over time (daily count of transactions).
db.transactions.aggregate([ { $group: { _id: { $dateToString: { format: "%Y-%m-%d", date: "$transaction_date" } }, transaction_count: { $sum: 1 } } }, { $sort: { "_id": 1 } } ])
[ { "from": "human", "value": "Here is mongodb schema {\"database\": {\"name\": \"fraud_detection_db\", \"collections\": [{\"name\": \"customers\", \"fields\": {\"_id\": \"ObjectId\", \"customer_id\": \"String\", \"name\": \"String\", \"email\": \"String\", \"phone\": \"String\", \"address\": {\"street\": \"S...
{ "database": { "name": "fraud_detection_db", "collections": [ { "name": "customers", "fields": { "_id": "ObjectId", "customer_id": "String", "name": "String", "email": "String...
Detect customers who made multiple transactions within a short period (e.g., 10 minutes).
db.transactions.aggregate([ { $group: { _id: "$customer_id", transactions: { $push: { transaction_date: "$transaction_date", amount: "$amount" } } } }, { $project: { customer_id: "$_id", rapid_transactions: { $filter: { ...
[ { "from": "human", "value": "Here is mongodb schema {\"database\": {\"name\": \"fraud_detection_db\", \"collections\": [{\"name\": \"customers\", \"fields\": {\"_id\": \"ObjectId\", \"customer_id\": \"String\", \"name\": \"String\", \"email\": \"String\", \"phone\": \"String\", \"address\": {\"street\": \"S...
{ "database": "RealTimeUserAnalytics", "collections": { "users": { "indexes": [ {"userId": 1, "unique": true}, {"email": 1, "unique": true} ], "schema": { "userId": "ObjectId", "email": "string", "username": "string", "firstName": "string", ...
count the occurrences of each product ID in an events collection and then sort them in descending order by frequency to understand product demand?
db.events.aggregate([ { $group: { _id: "$productId", demand: { $sum: 1 } } }, { $sort: { demand: -1 } } ]);
[ { "from": "human", "value": "Here is mongodb schema {\"database\": \"RealTimeUserAnalytics\", \"collections\": {\"users\": {\"indexes\": [{\"userId\": 1, \"unique\": true}, {\"email\": 1, \"unique\": true}], \"schema\": {\"userId\": \"ObjectId\", \"email\": \"string\", \"username\": \"string\", \"firstName\...
{ "database": { "name": "logistics_supply_chain_db", "collections": [ { "name": "shipments", "fields": { "_id": "ObjectId", "shipmentNumber": "String", "origin": { "warehouseId": "ObjectId", "address": "String", "departure...
Can you figures out what percentage of shipments were delivered on time?
db.shipments.aggregate([{ "$group": { "_id": null, "onTimeCount": { "$sum": { "$cond": [{ "$lte": ["$destination.arrivalTime", "$expectedArrivalTime"] }, 1, 0] } }, "totalCount": { "$sum": 1 } } }, { "$project": { "onTimePercentage": { "$multiply": [{ "$divide": ["$onTimeCount", "$totalCount"] }, 100] } } }])
[ { "from": "human", "value": "Here is mongodb schema {\"database\": {\"name\": \"logistics_supply_chain_db\", \"collections\": [{\"name\": \"shipments\", \"fields\": {\"_id\": \"ObjectId\", \"shipmentNumber\": \"String\", \"origin\": {\"warehouseId\": \"ObjectId\", \"address\": \"String\", \"departureTime\":...
{ "database": { "name": "stock_market_db",{ "collections": [ { "name": "stocks", "fields": { "_id": "ObjectId", "ticker": "string", "companyName": "string", "sector": "string", "industry": "string", "market": "string", "createdAt": "date", ...
we are looking for stocks that have reached their highest price in the last 52 weeks.
db.price_history.aggregate([{ $match: { date: { $gte: new ISODate("START_DATE") } } }, { $group: { _id: "$stockId", maxHigh: { $max: "$high" } } }, { $lookup: { from: "price_history", localField: "_id", foreignField: "stockId", as: "recent" } }, { $unwind: "$recent" }, { $match: { $expr: { $eq: ["$maxHigh", "$recent.hi...
[ { "from": "human", "value": "Here is mongodb schema and we are looking for stocks that have reached their highest price in the last 52 weeks." }, { "from": "gpt", "value": "db.price_history.aggregate([{$match: {date: {$gte: new ISODate(\"START_DATE\")}}}, {$group: {_id: \"$stockId\", maxHigh: ...
{ "database": { "name": "customer360_retail_db", "collections": [ { "name": "customers", "fields": { "_id": "ObjectId", "customer_id": "String", "first_name": "String", "last_n...
Find customers who made their last purchase over 12 months ago and are likely to churn.
db.transactions.aggregate([ { $group: { _id: "$customer_id", last_purchase: { $max: "$transaction_date" } } }, { $match: { last_purchase: { $lt: new Date(new Date().setFullYear(new Date().getFullYear() - 1)) } } } ])
[ { "from": "human", "value": "Here is mongodb schema {\"database\": {\"name\": \"customer360_retail_db\", \"collections\": [{\"name\": \"customers\", \"fields\": {\"_id\": \"ObjectId\", \"customer_id\": \"String\", \"first_name\": \"String\", \"last_name\": \"String\", \"email\": \"String\", \"phone\": \"Str...
{ "database": { "name": "social_sentiment_analysis_db", "collections": [ { "name": "social_posts", "fields": { "_id": "ObjectId", "post_id": "String", "platform": "String", "us...
Could you tell me how I could find the top 10 posts with the highest number of comments?
db.comments.aggregate([ { "$group": { "_id": "$post_id", "comment_count": { "$sum": 1 } } }, { "$sort": { "comment_count": -1 } }, { "$limit": 10 } ])
[ { "from": "human", "value": "Here is mongodb schema {\"database\": {\"name\": \"social_sentiment_analysis_db\", \"collections\": [{\"name\": \"social_posts\", \"fields\": {\"_id\": \"ObjectId\", \"post_id\": \"String\", \"platform\": \"String\", \"user\": {\"user_id\": \"String\", \"username\": \"String\", ...
{ "database": { "name": "social_sentiment_analysis_db", "collections": [ { "name": "social_posts", "fields": { "_id": "ObjectId", "post_id": "String", "platform": "String", "us...
Which posts have the most mentions?
db.social_posts.aggregate([ { "$project": { "post_id": 1, "mentions_count": { "$size": "$mentions" } } }, { "$sort": { "mentions_count": -1 } }, { "$limit": 10 } ])
[ { "from": "human", "value": "Here is mongodb schema {\"database\": {\"name\": \"social_sentiment_analysis_db\", \"collections\": [{\"name\": \"social_posts\", \"fields\": {\"_id\": \"ObjectId\", \"post_id\": \"String\", \"platform\": \"String\", \"user\": {\"user_id\": \"String\", \"username\": \"String\", ...
{ "database": { "name": "stock_market_db",{ "collections": [ { "name": "stocks", "fields": { "_id": "ObjectId", "ticker": "string", "companyName": "string", "sector": "string", "industry": "string", "market": "string", "createdAt": "date", ...
Can you tell me how many users there are for each role?
db.users.aggregate([{ $group: { _id: "$role", count: { $sum: 1 } } }])
[ { "from": "human", "value": "Here is mongodb schema and Can you tell me how many users there are for each role?" }, { "from": "gpt", "value": "db.users.aggregate([{$group: {_id: \"$role\", count: {$sum: 1}}}])" } ]
{ "database": { "name": "social_sentiment_analysis_db", "collections": [ { "name": "social_posts", "fields": { "_id": "ObjectId", "post_id": "String", "platform": "String", "us...
Can you tell me which ten hashtags are the most popular based on frequency of use in our social posts database?
db.social_posts.aggregate([ { "$unwind": "$hashtags" }, { "$group": { "_id": "$hashtags", "count": { "$sum": 1 } } }, { "$sort": { "count": -1 } }, { "$limit": 10 } ])
[ { "from": "human", "value": "Here is mongodb schema {\"database\": {\"name\": \"social_sentiment_analysis_db\", \"collections\": [{\"name\": \"social_posts\", \"fields\": {\"_id\": \"ObjectId\", \"post_id\": \"String\", \"platform\": \"String\", \"user\": {\"user_id\": \"String\", \"username\": \"String\", ...
{ "database": { "name": "recommendation_system",{ "collections": [ { "name": "users", "fields": { "_id": "ObjectId", "name": "string", "email": "string", "password": "string", "preferences": { "genres": ["string"], "languages": ["string...
Can you group user interactions by month and year, and show the total number of interactions for each month in ascending order?
db.user_interactions.aggregate([{ $group: { _id: { $dateToString: { format: "%Y-%m", date: "$interactionTimestamp" } }, count: { $sum: 1 } } }, { $sort: { _id: 1 } }])
[ { "from": "human", "value": "Here is mongodb schema and Can you group user interactions by month and year, and show the total number of interactions for each month in ascending order?" }, { "from": "gpt", "value": "db.user_interactions.aggregate([{$group: {_id: {$dateToString: {format: \"%Y-%m...
{ "database": { "name": "devops_log_event_db", "collections": [ { "name": "applications", "fields": { "_id": "ObjectId", "app_id": "String", "name": "String", "description": "S...
show you all the times when the automatic testing and deployment process didn't go as planned.
db.ci_cd_pipelines.find({ run_status: "Failed" }).sort({ executed_at: -1 });
[ { "from": "human", "value": "Here is mongodb schema {\"database\": {\"name\": \"devops_log_event_db\", \"collections\": [{\"name\": \"applications\", \"fields\": {\"_id\": \"ObjectId\", \"app_id\": \"String\", \"name\": \"String\", \"description\": \"String\", \"environment\": \"String\", \"owner\": \"Strin...
{ "database": { "name": "logistics_supply_chain_db", "collections": [ { "name": "shipments", "fields": { "_id": "ObjectId", "shipmentNumber": "String", "origin": { "warehouseId": "ObjectId", "address": "String", "departure...
Hey, can you show me the top 5 most active routes based on the number of shipments?
db.shipments.aggregate([{ "$group": { "_id": "$routeId", "count": { "$sum": 1 } } }, { "$sort": { "count": -1 } }, { "$limit": 5 }])
[ { "from": "human", "value": "Here is mongodb schema {\"database\": {\"name\": \"logistics_supply_chain_db\", \"collections\": [{\"name\": \"shipments\", \"fields\": {\"_id\": \"ObjectId\", \"shipmentNumber\": \"String\", \"origin\": {\"warehouseId\": \"ObjectId\", \"address\": \"String\", \"departureTime\":...
{ "database": { "name": "devops_log_event_db", "collections": [ { "name": "applications", "fields": { "_id": "ObjectId", "app_id": "String", "name": "String", "description": "S...
Finds all incidents that are still open or in progress.
db.incident_management.find({ status: { $ne: "Resolved" } });
[ { "from": "human", "value": "Here is mongodb schema {\"database\": {\"name\": \"devops_log_event_db\", \"collections\": [{\"name\": \"applications\", \"fields\": {\"_id\": \"ObjectId\", \"app_id\": \"String\", \"name\": \"String\", \"description\": \"String\", \"environment\": \"String\", \"owner\": \"Strin...
{ "database": { "name": "social_sentiment_analysis_db", "collections": [ { "name": "social_posts", "fields": { "_id": "ObjectId", "post_id": "String", "platform": "String", "us...
want to see how the sentiment in the comments has been changing over time,
db.comments.aggregate([ { "$group": { "_id": { "year": { "$year": "$created_at_platform" }, "month": { "$month": "$created_at_platform" } }, "avg_sentiment": { "$avg": "$sentiment_score" } } }, { "$sort": { "_id.year": 1, "_id.month": 1 } } ])
[ { "from": "human", "value": "Here is mongodb schema {\"database\": {\"name\": \"social_sentiment_analysis_db\", \"collections\": [{\"name\": \"social_posts\", \"fields\": {\"_id\": \"ObjectId\", \"post_id\": \"String\", \"platform\": \"String\", \"user\": {\"user_id\": \"String\", \"username\": \"String\", ...
{ "database": { "name": "genomic_analysis_healthcare_db", "collections": [ { "name": "patients", "fields": { "_id": "ObjectId", "patient_id": "String", "first_name": "String", ...
Which patients have the most sequenced genomes in the database?
db.genomes.aggregate([ { "$group": { "_id": "$patient_id", "count": { "$sum": 1 } } }, { "$sort": { "count": -1 } }, { "$limit": 10 } ])
[ { "from": "human", "value": "Here is mongodb schema {\"database\": {\"name\": \"genomic_analysis_healthcare_db\", \"collections\": [{\"name\": \"patients\", \"fields\": {\"_id\": \"ObjectId\", \"patient_id\": \"String\", \"first_name\": \"String\", \"last_name\": \"String\", \"gender\": \"String\", \"date_o...
{ "database": { "name": "logistics_supply_chain_db", "collections": [ { "name": "shipments", "fields": { "_id": "ObjectId", "shipmentNumber": "String", "origin": { "warehouseId": "ObjectId", "address": "String", "departure...
So you want to find out the delayed shipments by vehicle, right?
db.shipments.aggregate([{ "$match": { "destination.arrivalTime": { "$gt": "$expectedArrivalTime" } } }, { "$group": { "_id": "$assignedVehicleId", "delayedCount": { "$sum": 1 } } }, { "$sort": { "delayedCount": -1 } }])
[ { "from": "human", "value": "Here is mongodb schema {\"database\": {\"name\": \"logistics_supply_chain_db\", \"collections\": [{\"name\": \"shipments\", \"fields\": {\"_id\": \"ObjectId\", \"shipmentNumber\": \"String\", \"origin\": {\"warehouseId\": \"ObjectId\", \"address\": \"String\", \"departureTime\":...
{ "database": { "name": "genomic_analysis_healthcare_db", "collections": [ { "name": "patients", "fields": { "_id": "ObjectId", "patient_id": "String", "first_name": "String", ...
Could you summarize how the number of genome sequencing projects has changed annually?
db.genomes.aggregate([ { "$group": { "_id": { "$year": "$sequencing_date" }, "count": { "$sum": 1 } } }, { "$sort": { "_id": 1 } } ])
[ { "from": "human", "value": "Here is mongodb schema {\"database\": {\"name\": \"genomic_analysis_healthcare_db\", \"collections\": [{\"name\": \"patients\", \"fields\": {\"_id\": \"ObjectId\", \"patient_id\": \"String\", \"first_name\": \"String\", \"last_name\": \"String\", \"gender\": \"String\", \"date_o...
{ "database": { "name": "fraud_detection_db", "collections": [ { "name": "customers", "fields": { "_id": "ObjectId", "customer_id": "String", "name": "String", "email": "String...
Identify customers with the highest number of fraudulent transactions.
db.transactions.aggregate([ { $match: { "fraud_flag": true } }, { $group: { _id: "$customer_id", fraud_count: { $sum: 1 } } }, { $sort: { fraud_count: -1 } }, { $limit: 10 } ])
[ { "from": "human", "value": "Here is mongodb schema {\"database\": {\"name\": \"fraud_detection_db\", \"collections\": [{\"name\": \"customers\", \"fields\": {\"_id\": \"ObjectId\", \"customer_id\": \"String\", \"name\": \"String\", \"email\": \"String\", \"phone\": \"String\", \"address\": {\"street\": \"S...
{ "database": { "name": "smartcity_iot_db", "collections": [ { "name": "sensors", "fields": { "_id": "ObjectId", "sensor_id": "String", "type": "String", "location": { ...
Could you tell me which sensors have been setting off the most critical alerts?
db.alerts.aggregate([ { $match: { severity: "Critical" } }, { $group: { _id: "$sensor_id", criticalAlertCount: { $sum: 1 } } }, { $sort: { criticalAlertCount: -1 } } ]);
[ { "from": "human", "value": "Here is mongodb schema {\"database\": {\"name\": \"smartcity_iot_db\", \"collections\": [{\"name\": \"sensors\", \"fields\": {\"_id\": \"ObjectId\", \"sensor_id\": \"String\", \"type\": \"String\", \"location\": {\"latitude\": \"Double\", \"longitude\": \"Double\", \"address\": ...
{ "database": "RealTimeUserAnalytics", "collections": { "users": { "indexes": [ {"userId": 1, "unique": true}, {"email": 1, "unique": true} ], "schema": { "userId": "ObjectId", "email": "string", "username": "string", "firstName": "string", ...
how often users come back after their most recent visit.
db.sessions.aggregate([ { $group: { _id: "$userId", lastSession: { $max: "$createdAt" } } }, { $sort: { lastSession: -1 } } ]);
[ { "from": "human", "value": "Here is mongodb schema {\"database\": \"RealTimeUserAnalytics\", \"collections\": {\"users\": {\"indexes\": [{\"userId\": 1, \"unique\": true}, {\"email\": 1, \"unique\": true}], \"schema\": {\"userId\": \"ObjectId\", \"email\": \"string\", \"username\": \"string\", \"firstName\...
{ "database": { "name": "recommendation_system",{ "collections": [ { "name": "users", "fields": { "_id": "ObjectId", "name": "string", "email": "string", "password": "string", "preferences": { "genres": ["string"], "languages": ["string...
Can you tell me which device type has been used the most in our sessions? Just the top one will do.
db.sessions.aggregate([{ $group: { _id: "$deviceType", count: { $sum: 1 } } }, { $sort: { count: -1 } }, { $limit: 1 }])
[ { "from": "human", "value": "Here is mongodb schema and Can you tell me which device type has been used the most in our sessions? Just the top one will do." }, { "from": "gpt", "value": "db.sessions.aggregate([{$group: {_id: \"$deviceType\", count: {$sum: 1}}}, {$sort: {count: -1}}, {$limit: 1...
{ "database": { "name": "devops_log_event_db", "collections": [ { "name": "applications", "fields": { "_id": "ObjectId", "app_id": "String", "name": "String", "description": "S...
count the number of logs for each log level, like INFO, WARN, ERROR, and so on, using MongoDB?
db.logs.aggregate([ { $group: { _id: "$log_level", count: { $sum: 1 } } } ]);
[ { "from": "human", "value": "Here is mongodb schema {\"database\": {\"name\": \"devops_log_event_db\", \"collections\": [{\"name\": \"applications\", \"fields\": {\"_id\": \"ObjectId\", \"app_id\": \"String\", \"name\": \"String\", \"description\": \"String\", \"environment\": \"String\", \"owner\": \"Strin...
{ "database": { "name": "stock_market_db",{ "collections": [ { "name": "stocks", "fields": { "_id": "ObjectId", "ticker": "string", "companyName": "string", "sector": "string", "industry": "string", "market": "string", "createdAt": "date", ...
which sectors have the most stocks, you know?
db.stocks.aggregate([{ $group: { _id: "$sector", count: { $sum: 1 } } }, { $sort: { count: -1 } }])
[ { "from": "human", "value": "Here is mongodb schema and which sectors have the most stocks, you know?" }, { "from": "gpt", "value": "db.stocks.aggregate([{$group: {_id: \"$sector\", count: {$sum: 1}}}, {$sort: {count: -1}}])" } ]
{ "database": { "name": "genomic_analysis_healthcare_db", "collections": [ { "name": "patients", "fields": { "_id": "ObjectId", "patient_id": "String", "first_name": "String", ...
So, what's the breakdown of how significant different variants are clinically?
db.variants.aggregate([ { "$group": { "_id": "$clinical_significance", "count": { "$sum": 1 } } } ])
[ { "from": "human", "value": "Here is mongodb schema {\"database\": {\"name\": \"genomic_analysis_healthcare_db\", \"collections\": [{\"name\": \"patients\", \"fields\": {\"_id\": \"ObjectId\", \"patient_id\": \"String\", \"first_name\": \"String\", \"last_name\": \"String\", \"gender\": \"String\", \"date_o...
{ "database": { "name": "genomic_analysis_healthcare_db", "collections": [ { "name": "patients", "fields": { "_id": "ObjectId", "patient_id": "String", "first_name": "String", ...
Can you show me the top 10 most studied genetic markers in clinical studies?
db.clinical_studies.aggregate([ { "$unwind": "$genetic_markers" }, { "$group": { "_id": "$genetic_markers", "count": { "$sum": 1 } } }, { "$sort": { "count": -1 } }, { "$limit": 10 } ])
[ { "from": "human", "value": "Here is mongodb schema {\"database\": {\"name\": \"genomic_analysis_healthcare_db\", \"collections\": [{\"name\": \"patients\", \"fields\": {\"_id\": \"ObjectId\", \"patient_id\": \"String\", \"first_name\": \"String\", \"last_name\": \"String\", \"gender\": \"String\", \"date_o...
{ "database": "RealTimeUserAnalytics", "collections": { "users": { "indexes": [ {"userId": 1, "unique": true}, {"email": 1, "unique": true} ], "schema": { "userId": "ObjectId", "email": "string", "username": "string", "firstName": "string", ...
Can you help me figure out session durations, frequency, and device/browser preferences.
db.sessions.aggregate([ { $group: { _id: "$userId", totalSessions: { $sum: 1 }, avgSessionDuration: { $avg: { $subtract: ["$expiresAt", "$createdAt"] } }, deviceUsage: { $push: "$deviceType" } } } ]);
[ { "from": "human", "value": "Here is mongodb schema {\"database\": \"RealTimeUserAnalytics\", \"collections\": {\"users\": {\"indexes\": [{\"userId\": 1, \"unique\": true}, {\"email\": 1, \"unique\": true}], \"schema\": {\"userId\": \"ObjectId\", \"email\": \"string\", \"username\": \"string\", \"firstName\...
{ "database": { "name": "logistics_supply_chain_db", "collections": [ { "name": "shipments", "fields": { "_id": "ObjectId", "shipmentNumber": "String", "origin": { "warehouseId": "ObjectId", "address": "String", "departure...
How many shipments are there in total?
db.shipments.countDocuments({})
[ { "from": "human", "value": "Here is mongodb schema {\"database\": {\"name\": \"logistics_supply_chain_db\", \"collections\": [{\"name\": \"shipments\", \"fields\": {\"_id\": \"ObjectId\", \"shipmentNumber\": \"String\", \"origin\": {\"warehouseId\": \"ObjectId\", \"address\": \"String\", \"departureTime\":...
{ "database": { "name": "fraud_detection_db", "collections": [ { "name": "customers", "fields": { "_id": "ObjectId", "customer_id": "String", "name": "String", "email": "String...
Determine which merchants have the highest fraud activity.
db.transactions.aggregate([ { $match: { "fraud_flag": true } }, { $group: { _id: "$merchant.merchant_id", fraud_count: { $sum: 1 } } }, { $sort: { fraud_count: -1 } }, { $limit: 10 } ])
[ { "from": "human", "value": "Here is mongodb schema {\"database\": {\"name\": \"fraud_detection_db\", \"collections\": [{\"name\": \"customers\", \"fields\": {\"_id\": \"ObjectId\", \"customer_id\": \"String\", \"name\": \"String\", \"email\": \"String\", \"phone\": \"String\", \"address\": {\"street\": \"S...
{ "database": { "name": "genomic_analysis_healthcare_db", "collections": [ { "name": "patients", "fields": { "_id": "ObjectId", "patient_id": "String", "first_name": "String", ...
Can you help me find the top 10 patients who have the highest gene expression values?
db.gene_expressions.aggregate([ { "$sort": { "expression_value": -1 } }, { "$limit": 10 } ])
[ { "from": "human", "value": "Here is mongodb schema {\"database\": {\"name\": \"genomic_analysis_healthcare_db\", \"collections\": [{\"name\": \"patients\", \"fields\": {\"_id\": \"ObjectId\", \"patient_id\": \"String\", \"first_name\": \"String\", \"last_name\": \"String\", \"gender\": \"String\", \"date_o...
{ "database": { "name": "smartcity_iot_db", "collections": [ { "name": "sensors", "fields": { "_id": "ObjectId", "sensor_id": "String", "type": "String", "location": { ...
Find sensors generating the most data.
db.sensor_data.aggregate([ { $group: { _id: "$sensor_id", dataPoints: { $sum: 1 } } }, { $sort: { dataPoints: -1 } } ]);
[ { "from": "human", "value": "Here is mongodb schema {\"database\": {\"name\": \"smartcity_iot_db\", \"collections\": [{\"name\": \"sensors\", \"fields\": {\"_id\": \"ObjectId\", \"sensor_id\": \"String\", \"type\": \"String\", \"location\": {\"latitude\": \"Double\", \"longitude\": \"Double\", \"address\": ...
{ "database": { "name": "fraud_detection_db", "collections": [ { "name": "customers", "fields": { "_id": "ObjectId", "customer_id": "String", "name": "String", "email": "String...
Find customers with more than one account.
db.accounts.aggregate([ { $group: { _id: "$customer_id", account_count: { $sum: 1 } } }, { $match: { account_count: { $gt: 1 } } }, { $sort: { account_count: -1 } } ])
[ { "from": "human", "value": "Here is mongodb schema {\"database\": {\"name\": \"fraud_detection_db\", \"collections\": [{\"name\": \"customers\", \"fields\": {\"_id\": \"ObjectId\", \"customer_id\": \"String\", \"name\": \"String\", \"email\": \"String\", \"phone\": \"String\", \"address\": {\"street\": \"S...
{ "database": { "name": "devops_log_event_db", "collections": [ { "name": "applications", "fields": { "_id": "ObjectId", "app_id": "String", "name": "String", "description": "S...
Can you find me all the feature flags that are currently active?
db.feature_flags.find({ enabled_status: true });
[ { "from": "human", "value": "Here is mongodb schema {\"database\": {\"name\": \"devops_log_event_db\", \"collections\": [{\"name\": \"applications\", \"fields\": {\"_id\": \"ObjectId\", \"app_id\": \"String\", \"name\": \"String\", \"description\": \"String\", \"environment\": \"String\", \"owner\": \"Strin...
{ "database": "RealTimeUserAnalytics", "collections": { "users": { "indexes": [ {"userId": 1, "unique": true}, {"email": 1, "unique": true} ], "schema": { "userId": "ObjectId", "email": "string", "username": "string", "firstName": "string", ...
Measure the percentage of product views that result in a purchase.
db.events.aggregate([ { $match: { eventType: { $in: ["view", "purchase"] } } }, { $group: { _id: "$productId", views: { $sum: { $cond: [{ $eq: ["$eventType", "view"] }, 1, 0] } }, purchases: { $sum: { $cond: [{ $eq: ["$eventType", "purchase"] }, 1, 0] } } } }, { $project: { conversionRa...
[ { "from": "human", "value": "Here is mongodb schema {\"database\": \"RealTimeUserAnalytics\", \"collections\": {\"users\": {\"indexes\": [{\"userId\": 1, \"unique\": true}, {\"email\": 1, \"unique\": true}], \"schema\": {\"userId\": \"ObjectId\", \"email\": \"string\", \"username\": \"string\", \"firstName\...
{ "database": { "name": "devops_log_event_db", "collections": [ { "name": "applications", "fields": { "_id": "ObjectId", "app_id": "String", "name": "String", "description": "S...
Hey, can you tell me how to get the latest retention policy for a specific application with ID "app_12345"?
db.log_retention_policy.find({ app_id: "app_12345" }).sort({ timestamp: -1 }).limit(1);
[ { "from": "human", "value": "Here is mongodb schema {\"database\": {\"name\": \"devops_log_event_db\", \"collections\": [{\"name\": \"applications\", \"fields\": {\"_id\": \"ObjectId\", \"app_id\": \"String\", \"name\": \"String\", \"description\": \"String\", \"environment\": \"String\", \"owner\": \"Strin...
{ "database": { "name": "devops_log_event_db", "collections": [ { "name": "applications", "fields": { "_id": "ObjectId", "app_id": "String", "name": "String", "description": "S...
retrieve the latest 100 log entries for an application with the ID "app_12345"?
db.logs.find({ app_id: "app_12345" }).sort({ timestamp: -1 }).limit(100);
[ { "from": "human", "value": "Here is mongodb schema {\"database\": {\"name\": \"devops_log_event_db\", \"collections\": [{\"name\": \"applications\", \"fields\": {\"_id\": \"ObjectId\", \"app_id\": \"String\", \"name\": \"String\", \"description\": \"String\", \"environment\": \"String\", \"owner\": \"Strin...
{ "database": { "name": "stock_market_db",{ "collections": [ { "name": "stocks", "fields": { "_id": "ObjectId", "ticker": "string", "companyName": "string", "sector": "string", "industry": "string", "market": "string", "createdAt": "date", ...
So, let's find out the average trading volume for each day across all the stocks.
db.price_history.aggregate([{ $group: { _id: "$date", avgVolume: { $avg: "$volume" } } }, { $sort: { _id: -1 } }])
[ { "from": "human", "value": "Here is mongodb schema and So, let's find out the average trading volume for each day across all the stocks." }, { "from": "gpt", "value": "db.price_history.aggregate([{$group: {_id: \"$date\", avgVolume: {$avg: \"$volume\"}}}, {$sort: {_id: -1}}])" } ]
{ "database": { "name": "genomic_analysis_healthcare_db", "collections": [ { "name": "patients", "fields": { "_id": "ObjectId", "patient_id": "String", "first_name": "String", ...
So, like, what's the average genome coverage for each sequencing method?
db.genomes.aggregate([ { "$group": { "_id": "$method", "avg_coverage": { "$avg": "$genome_metadata.coverage" } } } ])
[ { "from": "human", "value": "Here is mongodb schema {\"database\": {\"name\": \"genomic_analysis_healthcare_db\", \"collections\": [{\"name\": \"patients\", \"fields\": {\"_id\": \"ObjectId\", \"patient_id\": \"String\", \"first_name\": \"String\", \"last_name\": \"String\", \"gender\": \"String\", \"date_o...
{ "database": { "name": "stock_market_db",{ "collections": [ { "name": "stocks", "fields": { "_id": "ObjectId", "ticker": "string", "companyName": "string", "sector": "string", "industry": "string", "market": "string", "createdAt": "date", ...
Can you find the top 5 most volatile stocks from last week? The volatility is calculated by the difference between the highest and lowest prices, expressed as a percentage of the opening price.
db.price_history.aggregate([{ $match: { date: { $gte: new ISODate("START_DATE") } } }, { $group: { _id: "$stockId", maxHigh: { $max: "$high" }, minLow: { $min: "$low" }, firstOpen: { $first: "$open" } } }, { $project: { stockId: "$_id", volatility: { $multiply: [ { $divide: [ { $subtract: ["$maxHigh", "$minLow"] }, "$f...
[ { "from": "human", "value": "Here is mongodb schema and Can you find the top 5 most volatile stocks from last week? The volatility is calculated by the difference between the highest and lowest prices, expressed as a percentage of the opening price." }, { "from": "gpt", "value": "db.price_hist...
{ "database": { "name": "stock_market_db",{ "collections": [ { "name": "stocks", "fields": { "_id": "ObjectId", "ticker": "string", "companyName": "string", "sector": "string", "industry": "string", "market": "string", "createdAt": "date", ...
Who are the top 5 users who have created the most alerts?
db.alerts.aggregate([{ $group: { _id: "$userId", alertCount: { $sum: 1 } } }, { $sort: { alertCount: -1 } }, { $limit: 5 }])
[ { "from": "human", "value": "Here is mongodb schema and Who are the top 5 users who have created the most alerts?" }, { "from": "gpt", "value": "db.alerts.aggregate([{$group: {_id: \"$userId\", alertCount: {$sum: 1}}}, {$sort: {alertCount: -1}}, {$limit: 5}])" } ]
{ "database": { "name": "recommendation_system",{ "collections": [ { "name": "users", "fields": { "_id": "ObjectId", "name": "string", "email": "string", "password": "string", "preferences": { "genres": ["string"], "languages": ["string...
Can you help me find out which language appears most frequently in our content database?
db.content.aggregate([{ $unwind: "$languages" }, { $group: { _id: "$languages", count: { $sum: 1 } } }, { $sort: { count: -1 } }, { $limit: 1 }])
[ { "from": "human", "value": "Here is mongodb schema and Can you help me find out which language appears most frequently in our content database?" }, { "from": "gpt", "value": "db.content.aggregate([{$unwind: \"$languages\"}, {$group: {_id: \"$languages\", count: {$sum: 1}}}, {$sort: {count: -1...
{ "database": { "name": "logistics_supply_chain_db", "collections": [ { "name": "shipments", "fields": { "_id": "ObjectId", "shipmentNumber": "String", "origin": { "warehouseId": "ObjectId", "address": "String", "departure...
calculate the occupancy rate for each warehouse, including its name, current inventory quantity, and total capacity?
db.warehouses.aggregate([{ "$project": { "name": 1, "occupancyRate": { "$divide": [{ "$sum": "$currentInventory.quantity" }, "$capacity"] } } }])
[ { "from": "human", "value": "Here is mongodb schema {\"database\": {\"name\": \"logistics_supply_chain_db\", \"collections\": [{\"name\": \"shipments\", \"fields\": {\"_id\": \"ObjectId\", \"shipmentNumber\": \"String\", \"origin\": {\"warehouseId\": \"ObjectId\", \"address\": \"String\", \"departureTime\":...
{ "database": { "name": "logistics_supply_chain_db", "collections": [ { "name": "shipments", "fields": { "_id": "ObjectId", "shipmentNumber": "String", "origin": { "warehouseId": "ObjectId", "address": "String", "departure...
who are the top 5 users who made the most updates in the shipment logs?
db.shipments.aggregate([{ "$unwind": "$logs" }, { "$group": { "_id": "$logs.updatedByUserId", "count": { "$sum": 1 } } }, { "$sort": { "count": -1 } }, { "$limit": 5 }])
[ { "from": "human", "value": "Here is mongodb schema {\"database\": {\"name\": \"logistics_supply_chain_db\", \"collections\": [{\"name\": \"shipments\", \"fields\": {\"_id\": \"ObjectId\", \"shipmentNumber\": \"String\", \"origin\": {\"warehouseId\": \"ObjectId\", \"address\": \"String\", \"departureTime\":...
{ "database": { "name": "smartcity_iot_db", "collections": [ { "name": "sensors", "fields": { "_id": "ObjectId", "sensor_id": "String", "type": "String", "location": { ...
Identify sensors that have been offline for the longest time.
db.sensors.aggregate([ { $project: { sensor_id: 1, downtime_hours: { $divide: [{ $subtract: [new Date(), "$last_online"] }, 3600000] } } }, { $sort: { downtime_hours: -1 } }, { $limit: 10 } ]);
[ { "from": "human", "value": "Here is mongodb schema {\"database\": {\"name\": \"smartcity_iot_db\", \"collections\": [{\"name\": \"sensors\", \"fields\": {\"_id\": \"ObjectId\", \"sensor_id\": \"String\", \"type\": \"String\", \"location\": {\"latitude\": \"Double\", \"longitude\": \"Double\", \"address\": ...
{ "database": { "name": "fraud_detection_db", "collections": [ { "name": "customers", "fields": { "_id": "ObjectId", "customer_id": "String", "name": "String", "email": "String...
Analyze which transaction channels (e.g., online, ATM, mobile) have the most fraud cases.
db.transactions.aggregate([ { $match: { "fraud_flag": true } }, { $group: { _id: "$channel", fraud_count: { $sum: 1 } } }, { $sort: { fraud_count: -1 } } ])
[ { "from": "human", "value": "Here is mongodb schema {\"database\": {\"name\": \"fraud_detection_db\", \"collections\": [{\"name\": \"customers\", \"fields\": {\"_id\": \"ObjectId\", \"customer_id\": \"String\", \"name\": \"String\", \"email\": \"String\", \"phone\": \"String\", \"address\": {\"street\": \"S...
{ "database": { "name": "fraud_detection_db", "collections": [ { "name": "customers", "fields": { "_id": "ObjectId", "customer_id": "String", "name": "String", "email": "String...
find customers who have made transactions from more than one country?
db.transactions.aggregate([ { $group: { _id: "$customer_id", countries: { $addToSet: "$merchant.location.country" } } }, { $match: { "countries.1": { $exists: true } } } ])
[ { "from": "human", "value": "Here is mongodb schema {\"database\": {\"name\": \"fraud_detection_db\", \"collections\": [{\"name\": \"customers\", \"fields\": {\"_id\": \"ObjectId\", \"customer_id\": \"String\", \"name\": \"String\", \"email\": \"String\", \"phone\": \"String\", \"address\": {\"street\": \"S...
{ "database": { "name": "recommendation_system",{ "collections": [ { "name": "users", "fields": { "_id": "ObjectId", "name": "string", "email": "string", "password": "string", "preferences": { "genres": ["string"], "languages": ["string...
Can you calculate the average duration of sessions from a database, where each session has a start and end time?
db.sessions.aggregate([{ $project: { duration: { $subtract: ["$sessionEnd", "$sessionStart"] } } }, { $group: { _id: null, avgDuration: { $avg: "$duration" } } }])
[ { "from": "human", "value": "Here is mongodb schema and Can you calculate the average duration of sessions from a database, where each session has a start and end time?" }, { "from": "gpt", "value": "db.sessions.aggregate([{$project: {duration: {$subtract: [\"$sessionEnd\", \"$sessionStart\"]}...
{ "database": { "name": "logistics_supply_chain_db", "collections": [ { "name": "shipments", "fields": { "_id": "ObjectId", "shipmentNumber": "String", "origin": { "warehouseId": "ObjectId", "address": "String", "departure...
Can you show me the shipment tracking history for a specific shipment?
db.shipments.find({ "_id": ObjectId("shipmentId") }, { "logs": 1 })
[ { "from": "human", "value": "Here is mongodb schema {\"database\": {\"name\": \"logistics_supply_chain_db\", \"collections\": [{\"name\": \"shipments\", \"fields\": {\"_id\": \"ObjectId\", \"shipmentNumber\": \"String\", \"origin\": {\"warehouseId\": \"ObjectId\", \"address\": \"String\", \"departureTime\":...
{ "database": "RealTimeUserAnalytics", "collections": { "users": { "indexes": [ {"userId": 1, "unique": true}, {"email": 1, "unique": true} ], "schema": { "userId": "ObjectId", "email": "string", "username": "string", "firstName": "string", ...
Track total searches, views, clicks, purchases, and wishlist additions per user.
db.events.aggregate([ { $group: { _id: "$userId", totalEvents: { $sum: 1 }, eventBreakdown: { $push: "$eventType" } } } ]);
[ { "from": "human", "value": "Here is mongodb schema {\"database\": \"RealTimeUserAnalytics\", \"collections\": {\"users\": {\"indexes\": [{\"userId\": 1, \"unique\": true}, {\"email\": 1, \"unique\": true}], \"schema\": {\"userId\": \"ObjectId\", \"email\": \"string\", \"username\": \"string\", \"firstName\...
{ "database": { "name": "devops_log_event_db", "collections": [ { "name": "applications", "fields": { "_id": "ObjectId", "app_id": "String", "name": "String", "description": "S...
Finds all ERROR logs generated in the last 24 hours.
db.logs.find({ log_level: "ERROR", timestamp: { $gte: new Date(new Date().setDate(new Date().getDate() - 1)) } }).sort({ timestamp: -1 });
[ { "from": "human", "value": "Here is mongodb schema {\"database\": {\"name\": \"devops_log_event_db\", \"collections\": [{\"name\": \"applications\", \"fields\": {\"_id\": \"ObjectId\", \"app_id\": \"String\", \"name\": \"String\", \"description\": \"String\", \"environment\": \"String\", \"owner\": \"Strin...
{ "database": { "name": "smartcity_iot_db", "collections": [ { "name": "sensors", "fields": { "_id": "ObjectId", "sensor_id": "String", "type": "String", "location": { ...
Identify recurring sensor issues.
db.alerts.aggregate([ { $group: { _id: "$alert_type", count: { $sum: 1 } } }, { $sort: { count: -1 } } ]);
[ { "from": "human", "value": "Here is mongodb schema {\"database\": {\"name\": \"smartcity_iot_db\", \"collections\": [{\"name\": \"sensors\", \"fields\": {\"_id\": \"ObjectId\", \"sensor_id\": \"String\", \"type\": \"String\", \"location\": {\"latitude\": \"Double\", \"longitude\": \"Double\", \"address\": ...
{ "database": { "name": "customer360_retail_db", "collections": [ { "name": "customers", "fields": { "_id": "ObjectId", "customer_id": "String", "first_name": "String", "last_n...
Find the number of customers in each country.
db.customers.aggregate([ { $group: { _id: "$address.country", customer_count: { $sum: 1 } } }, { $sort: { customer_count: -1 } } ])
[ { "from": "human", "value": "Here is mongodb schema {\"database\": {\"name\": \"customer360_retail_db\", \"collections\": [{\"name\": \"customers\", \"fields\": {\"_id\": \"ObjectId\", \"customer_id\": \"String\", \"first_name\": \"String\", \"last_name\": \"String\", \"email\": \"String\", \"phone\": \"Str...
{ "database": { "name": "logistics_supply_chain_db", "collections": [ { "name": "shipments", "fields": { "_id": "ObjectId", "shipmentNumber": "String", "origin": { "warehouseId": "ObjectId", "address": "String", "departure...
Can you tell me the top five routes that usually take the longest time to travel?
db.routes.aggregate([{ "$sort": { "expectedTravelTimeInHours": -1 } }, { "$limit": 5 }])
[ { "from": "human", "value": "Here is mongodb schema {\"database\": {\"name\": \"logistics_supply_chain_db\", \"collections\": [{\"name\": \"shipments\", \"fields\": {\"_id\": \"ObjectId\", \"shipmentNumber\": \"String\", \"origin\": {\"warehouseId\": \"ObjectId\", \"address\": \"String\", \"departureTime\":...
{ "database": { "name": "logistics_supply_chain_db", "collections": [ { "name": "shipments", "fields": { "_id": "ObjectId", "shipmentNumber": "String", "origin": { "warehouseId": "ObjectId", "address": "String", "departure...
Can you show me how the shipment status has been changing over time?
db.shipments.aggregate([{ "$unwind": "$logs" }, { "$group": { "_id": { "date": { "$dateToString": { "format": "%Y-%m-%d", "date": "$logs.timestamp" } }, "status": "$logs.status" }, "count": { "$sum": 1 } } }, { "$sort": { "_id.date": 1 } }])
[ { "from": "human", "value": "Here is mongodb schema {\"database\": {\"name\": \"logistics_supply_chain_db\", \"collections\": [{\"name\": \"shipments\", \"fields\": {\"_id\": \"ObjectId\", \"shipmentNumber\": \"String\", \"origin\": {\"warehouseId\": \"ObjectId\", \"address\": \"String\", \"departureTime\":...