1

I have events and an events_date objects and want to know how to do a join query like this:

  select * 
  from events, events_dates  
  where events.objectid=event_dates.eventID
  order by event_dates.startDate asc

here is my schema. I have included this so you can see how simple this is, however doing a join is very difficult using the ydn-db api:

 var events_schema = {
 name:          'events',
 keyPath:       'objectid',
 type:          'TEXT',
 autoIncrement: false,
 indexes: [
 {
  keyPath:   'eventName'
  }, {
  keyPath:   'contactPerson'
 }, {
  keyPath:   'contactPersonEmail'
 }, {
  keyPath:   'contactPersonCell'
 }, {
  keyPath:   'eventURL'
 }, {
  keyPath:   'city'
 }, {
  keyPath:   'address'
 }, {
  keyPath:   'parishStateProvince'
 }, {
  keyPath:   'country'
 }, {
  keyPath:   'isFeatured'
 }, {
  keyPath:   'shortDescription'
 }, {
  keyPath:   'salesCutOffHour'
 }, {
  keyPath:   'venu'
 }, {
  keyPath:   'longDescription'
 }, {
   keyPath: 'createdAt' 
 }

 ] 
 };


 var events_dates_schema = {
 name:          'event_dates',
 keyPath:       'objectid',
 type:          'TEXT',
 autoIncrement: false,
indexes: [
{
  keyPath:   'eventID'
}, {
  keyPath:   'deliveryMethodMobile'
}, {
  keyPath:   'deliveryMethodWillCall'
}, {
  keyPath:   'endDate'
}, {
  keyPath:   'endAmPm'
}, {
  keyPath:   'maxAvailableTickets'
}, {
  keyPath:   'salesCutOffHour'
}, {
  keyPath:   'startAmPm'
}, {
  keyPath:   'startDate'
}

] 
};
jessiPP
  • 436
  • 1
  • 6
  • 21

1 Answers1

0

I will copy answer as linked by @Risingson.

Currently you will have to use ydn.db.algo.ZigzagMerge with compound indexes [objectid, startDate], [eventID, startDate], which is very difficult to use. Hopefully (or never) I will finish query module, in that case you just write multiple where clause for any equal join.

Kyaw Tun
  • 12,447
  • 10
  • 56
  • 83