ng-feathers
ng-feathers copied to clipboard
how to use the find () method
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.
What does you backend look like? Which version of Feathers, Sequelize, Mongoose, etc. are you using?
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
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.