QUERY
I'm trying to query a collection using the code below, as suggested here. It works fine for venueName but not for venueLocation - I'm guessing it must be something to do with the fact that it's a sub-schema, and I'm not writing the query properly.
var query = {};
if(Session.get('venueNameVar')) {
query.venueName = Session.get('venueNameVar')
}
if(Session.get('venueLocationVar')){
query.venueAddress = {
neighbourhood : Session.get('venueLocationVar')
}
return Venues.find(query);
COLLECTIONS
My main schema and sub-schema work well across the app so far:
//MAIN SCHEMA
Schema.Venues = new SimpleSchema({
venueAddress: {
type: Schema.VenueAddress,
optional: true
}, [...]
//SUB-SCHEMA
Schema.VenueAddress = new SimpleSchema({
neighbourhood: {
type: String,
max: 100,
optional: true
}, [...]
WHAT I'VE TRIED
- Using
Schema.venueAddress.neighbourhood = Sesssion.get('venueLocationVar')
- does not work - Changing VenueAddress --> venueAddress - does not work
- Using square brackets, equals instead of colon, etc. - does not work