Search code examples
javascriptnode.jsderbyjs

DerbyJS Find Record from collection


I wand to get record from collection

var query=model.query('sales.dept',{price:100});
model.subscribe(query,function(err,bun)
{
       var data= query.ref('+page.sales').get();
         //its return empty array
          console.log(data);
});

Solution

  • The problem might be query.ref('+page.sales'), you probably want something like query.ref('_page.sales') instead.

    Try the following, and make sure that you have added data to the collection.

    var query = model.query('sales.dept',{price:100});
    query.subscribe(function(err) {
       query.ref('_page.sales');
       console.log('Data', query.get());
    });