ng-feathers icon indicating copy to clipboard operation
ng-feathers copied to clipboard

how to use the find () method

Open GlauberF opened this issue 7 years ago • 3 comments

how to use the find () method

I'm going through this:

var meLigaService = $feathers.service('me-liga');

function buscarServicos (txt) {
            console.log(txt)

            meLigaService.find({query: {'mlig_nome': txt, 'mlig_email': txt}}).then(function (res) {              
              console.log(res)
            }).catch(function (err) {
              console.error(err)
            })
        }

(mlig_name) and (mlig_email) are two fields that I have in the database and (txt) is what the user is typing.

But regardless of what is typed, it returns all the same data from the database.

GlauberF avatar May 17 '18 12:05 GlauberF

What does you backend look like? Which version of Feathers, Sequelize, Mongoose, etc. are you using?

beevelop avatar May 17 '18 12:05 beevelop

in my backend it looks like this:

const { disallow } = require('feathers-hooks-common');

module.exports = {
  before: {
    all: [],
    find: [],
    get: [],
    create: [],
    update: [],
    patch: [],
    remove: [ disallow() ]
  },

  after: {
    all: [],
    find: [],
    get: [],
    create: [],
    update: [],
    patch: [],
    remove: []
  },

  error: {
    all: [],
    find: [],
    get: [],
    create: [],
    update: [],
    patch: [],
    remove: []
  }
};

and

// Initializes the `me liga` service on path `/me-liga`
const createService = require('feathers-mongoose');
const createModel = require('../../models/me-liga.model');
const hooks = require('./me-liga.hooks');

module.exports = function (app) {
  const Model = createModel(app);
  const paginate = app.get('paginate');

  const options = {
    name: 'me-liga',
    Model,
    paginate
  };

  // Initialize our service with any options it requires
  app.use('/me-liga', createService(options));

  // Get our initialized service so that we can register hooks and filters
  const service = app.service('me-liga');

  service.hooks(hooks);
};

I use Mongoose and am using feathers 3.5.0

GlauberF avatar May 17 '18 14:05 GlauberF

Yeah, well. I'm still not confident, that the client in v1.7.2 is compatible with the Feathers backend in v3.5.0. Could you try out the „new“ next branch? It features a more recent version of the feathers-client and might be compatible. Unfortunately I don't have the time to evaluate the basic functionality, as I'm no longer relying on feathers for my own applications.

beevelop avatar May 17 '18 14:05 beevelop