$or oplog enabled?

How’s the performance of MongoDB’s $or with Meteor?

Which pattern would probably be better for a Meteor application?:

Pattern 1

//client
Meteor.subscribe('friday-docs')
Meteor.subscribe('saturday-docs')
Meteor.subscribe('sunday-docs')

//server
Meteor.publish('friday-docs', function(){
  return Docs.find({'times.friday':{$lte:12, $gte: 6}})
})
Meteor.publish('friday-docs', function(){
  return Docs.find({'times.saturday':{$lte:12, $gte: 6}})
})
Meteor.publish('friday-docs', function(){
  return Docs.find({'times.sunday':{$lte:12, $gte: 6}})
})

Pattern 2

//client
Meteor.subscribe('all-docs')

//server
Meteor.publish('all-docs', function(){
  var orQuery = [
    {'times.friday':{$lte:12, $gte: 6}},
    {'times.saturday':{$lte:12, $gte: 6}},
    {'times.sunday':{$lte:12, $gte: 6}}
  ]
  return Docs.find({$or:orQuery})
})

As far as I can tell, $or operator uses oplog. You cen refer here for unsupported operators.

1 Like

Thanks for the meteorhacks link!

I think I just broke Meteor :confused:

Exception in defer callback: Error: The Mongo server and the Meteor query disagree on how many
documents match your query. Maybe it is hitting a Mongo edge case? The query is: ...

The error does mention that it’s using the oplog observe driver though…