Meteor/Mongo DB $gte operator not working on find();


Hi, I am trying to make a query so that I only return the ‘productos’ that are on the current ‘categoria’, they also need to have the ‘stock.cantidad’ field greater or equal than 1 and the ‘stock.idCedis’ equal to a specific value, and this is how I am trying to do it:

return Productos.find(
          idCategoria: Router.current().params._id,
          "stock.cantidad":{$gte: 1},

I checked and the “stock.idCedis”:idCedis is working just fine displaying the ‘productos’ that have that specific ‘idCedis’, but what I am having problems with is the “stock.cantidad”:{$gte: 1}, part because I don’t know why Meteor or Mongo DB for that matter are just ignoring it.

The schema for the stock part of ‘productos’ that I am currently using is this:

stock: {
    type: [Object]
    "stock.$.cantidad": {
      type: Number,
      label: "Cantidad de Stock",
      min: 0
    "stock.$.idCedis": {
      type: String,
      label: "Centro de Distribución"

So I would like to know if I am doing something wrong or any other way I could make this work, thanks so much in advance!


If anybody is looking for an answer on this, I finally got it right thanks to some help on stack overflow and this is how I did it:

          idCategoria: Router.current().params._id,
          stock: { $elemMatch: { idCedis: idCedis, cantidad: { $gte: 0 } } }