Closed aaghevli closed 7 years ago
Pending merge in #56
Hello @aaghevli,
So I am looking to put together a query for events starting today using the following endpoint and parameters (using Postman):
https://resistance-calendar.herokuapp.com/v1/events?$filter=start_date%20gt%20%272017-04-15%27&$orderby=start_date
However, it looks like the results I'm getting are based on the created_date
or modified_date
properties instead of the start_date
property. Below is the first few event records in the response I'm getting.
Is this expected behavior, or is my query incorrect?
{
"total_pages": 51,
"per_page": 25,
"page": 0,
"total_records": 1263,
"_embedded": {
"osdi:events": [
{
"_id": "58e9a50c74ceb9d94e193cee",
"__v": 0,
"date": "2017-04-09T16:32:17.840Z",
"location": null,
"guests_can_invite_others": true,
"start_date": "2020-11-03T14:00:00.000Z",
"total_accepted": 44,
"description": "Its not too early to get ready.",
"title": "Election Day 2020",
"name": "Election Day 2020",
"origin_system": "Facebook",
"modified_date": "2017-04-16T14:09:28.083Z",
"created_date": "2017-04-16T14:09:28.083Z",
"featured_image_url": "http://res.cloudinary.com/hqrdtqlz0/image/upload/facebook:10103995236725424",
"identifiers": [
"facebook:423772127967040"
]
},
{
"_id": "58e9a50c74ceb9d94e193cef",
"__v": 0,
"date": "2017-04-09T16:32:17.853Z",
"location": {
"identifiers": [
"facebook:1236632846415467"
],
"created_date": "2017-04-16T14:09:28.156Z",
"modified_date": "2017-04-16T14:09:28.156Z",
"origin_system": "Facebook",
"venue": null,
"address_lines": [],
"locality": null,
"region": null,
"postal_code": null,
"location": {
"type": "Point",
"coordinates": [
-100,
40
]
}
},
"guests_can_invite_others": true,
"start_date": "2018-11-06T06:01:00.000Z",
"total_accepted": 74123,
"description": "Our best chance to stop President Trump, and his radical agenda, is to organize early and elect a Democratic Congress in 2018.\n\nYoung voters, liberals/progressives, and Democrats tend to skip elections in non-presidential years. That has to stop!\n\nHere's how you can help:\n\n1) RSVP \"Going\" for a reminder to vote on Election Day 2018, and/or add this to your calendar by clicking http://evt.mx/oy0WB9A7. \n\n2) Register to vote at https://turbovote.org/ or https://www.iwillvote.com/learn/.\n\n3) Share this event with your friends. \n\n4) Follow our Facebook page Take Back Congress 2018.\n\nThe hosts: Brett and Alli met in college. Brett is a writer and campaign veteran. Alli's an artist. Basically they're two friends who think Trump's ideas, cabinet appointments, and tweets are completely bonkers and dangerous. Let's do something about it.",
"title": "Take Back Congress 2018",
"name": "Take Back Congress 2018",
"origin_system": "Facebook",
"modified_date": "2017-04-16T14:09:28.156Z",
"created_date": "2017-04-16T14:09:28.156Z",
"featured_image_url": "http://res.cloudinary.com/hqrdtqlz0/image/upload/facebook:10101380048443654",
"identifiers": [
"facebook:1236632846415467"
]
},
{
"_id": "58e9a50c74ceb9d94e193cf0",
"__v": 0,
"date": "2017-04-09T16:32:17.855Z",
"location": {
"identifiers": [
"facebook:737098406434114"
],
"created_date": "2017-04-16T14:09:28.259Z",
"modified_date": "2017-04-16T14:09:28.259Z",
"origin_system": "Facebook",
"venue": "Geo Group",
"address_lines": [],
"locality": "San Antonio, TX",
"region": null,
"postal_code": "78217",
"location": {
"type": "Point",
"coordinates": [
-98.435508,
29.516496
]
}
},
"guests_can_invite_others": true,
"start_date": "2018-03-21T17:00:00.000Z",
"total_accepted": 273,
"description": "Corrections Corporation of America is one of the largest for profit prison companies making millions off the Mass Incarceration of Blacks and the Poor through lobbying, direct campaign contributions and increasing their influence politically. CCA was quoted in their 2014 Annual Report: \"The demand for our facilities and services could be adversely affected by the relaxation of enforcement efforts, leniency in conviction or parole standards and sentencing practices or through the decriminalization of certain activities that are currently proscribed by our criminal laws. For instance, any changes with respect to drugs and controlled substances or illegal immigration could affect the number of persons arrested, convicted, and sentenced, thereby potentially reducing demand for correctional facilities to house them.\" Do not allow CCA to profit from Mass Incarceration. Join us in Protesting CCA's private industry for profit \"slavery\". \n\nUPDATE: The Corrections Corporation of America, GEO Group, and the Avalon Corporation all have facilities in the Austin, Texas area and Wells Fargo, Bank of America, Barclays Intl. and Merrlin Lynch have invested in private prisons. In honor of the Robert Sobukwe who lead a demonstration to a Soweto, South Africa police station on March 21, 1960 and those who lost their lives protesting apartheid and police brutality at the Sharpeville Massacre on March 21, 1960 at a Sharpeville police station, we will continue to uphold the date of March 21. We will make this a mass protest with organizations and advocates working to dismantle the prison industrial complex in the fields of mental health, rehabilitation, recidivsm, and criminal justice. \n\nFURTHER UPDATE: To avoid displacement of the residents of the Austin Transitional Center, 3154 East Highway 71, Austin, Texas 78617 we have moved this event to next year 2018 back to the GEO Group's new headquarters 1777 NE Loop 410, San Antonio, Texas 78217.",
"title": "Protest at Corrections Corporation of America: End Mass Incarceration",
"name": "Protest at Corrections Corporation of America: End Mass Incarceration",
"origin_system": "Facebook",
"modified_date": "2017-04-16T14:09:28.259Z",
"created_date": "2017-04-16T14:09:28.259Z",
"featured_image_url": "http://res.cloudinary.com/hqrdtqlz0/image/upload/facebook:517393091758011",
"identifiers": [
"facebook:737098406434114"
]
},
I think you may want to add 'desc' in order to get the ordering the way you want it.
I am looking forwards to using a mock mongodb very soon to make sure all this works with certainty, but the query looks as expected after the desc keyword
Ahh, cool, that worked! So once we switch to the mock mongodb, will the response come back the same way? Just want to make sure we don't have to change client-side code to match a different response.
Sorry for the confusion. There is no switching. That database is a production instance. I may do a bulk deletion and repopulation just to be sure here are no dummy events, but it's official.
Any mock db will be for tests.
And awesome that is worked! It's getting really real!
ODATA has affordances for ordering using the $orderby query parameter which probably has some equivalent in mongo.