Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need API routes for Trade Routes Feature #60

Open
patrickrb opened this issue Mar 2, 2016 · 1 comment
Open

Need API routes for Trade Routes Feature #60

patrickrb opened this issue Mar 2, 2016 · 1 comment

Comments

@patrickrb
Copy link
Owner

This should be an epic. I need to wrap my head around how to do trade routes with the data we have.

@patrickrb
Copy link
Owner Author

So far I have an aggregation query for mongo that returns the mins and maxes for a selected commodity:

db.listings.aggregate(

  // Pipeline
  [
    // Stage 1
    {
      $match: {
       commodity_id: NumberInt(35)
      }
    },

    // Stage 2
    {
      $project: {
        "station_id": 1,
        "sell_price": 1,
        "buy_price": 1,
        "commodity_id": 1
      }
    },

    // Stage 3
    {
      $group: {
            _id: { station_id: "$station_id",commodity_id: "$commodity_id"},
        buy_max:{ $max: "$buy_price"},
        sell_min: { $min: "$sell_price"}
      }
    }

  ]

  // Created with 3T MongoChef, the GUI for MongoDB - http://3t.io/mongochef

);

@patrickrb patrickrb changed the title Need API routes for Trade Routes Need API routes for Trade Routes Feature Mar 2, 2016
@patrickrb patrickrb added this to the Trade Routes - API Routes milestone Mar 3, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant