Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save paulchubatyy/1281983 to your computer and use it in GitHub Desktop.
Save paulchubatyy/1281983 to your computer and use it in GitHub Desktop.
random sql & json & query
SELECT *
FROM journey j
JOIN location l ON l.id = j.departure_id
WHERE l.city = 'Ternopil';
{
name: 'Поїздка по містах Східної Європи',
departure_date: '2011-07-25',
arrival_date: '2011-08-15',
departure_location: {
street: 'Komvest',
city: 'Bruges',
region: 'Belgium'
},
arrival_location: {
street: '5th avenue',
city: 'Paris',
region: 'France'
},
stops: [
{
city: 'Mitri-Mori',
region: 'France'
},
{
city: 'Compiegne',
region: 'France'
}
],
organizer: 4e8c9e154529c67e04000000,
users: [4e8c9e154529cd3304000000, 4e8c9e1545267e04000000],
}
db.journeys.find({departure_location.city: "Ternopil", departure_date: {$gte: start, $lt: end}, arrival_date: {$gte: start, $lt: end}});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment