Created
October 12, 2011 17:54
-
-
Save paulchubatyy/1281983 to your computer and use it in GitHub Desktop.
random sql & json & query
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT * | |
FROM journey j | |
JOIN location l ON l.id = j.departure_id | |
WHERE l.city = 'Ternopil'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
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], | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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