// vendor.class.js
import FeathersMongoose from 'feathers-mongoose'
import VendorModal from '../../models/vendor.model.js'
// By default calls the standard MongoDB adapter service methods but can be customized with your own functionality.
export class VendorService extends FeathersMongoose.Service {}
export const getOptions = (app) => {
return {
paginate: app.get('paginate'),
whitelist: ['$populate'],
Model: VendorModal(app)
}
}
```js
// vendor.service.js
import { VendorService, getOptions } from './vendor.class.js'
export const vendor = (app) => {
// Register our service on the Feathers application
app.use('vendors', new VendorService(getOptions(app)), {
// A list of all methods this service exposes externally
methods: ['find'],
events: []
})
// Initialize hooks
app.service('vendors').hooks([])
}
and i have registered the service, in most common way. I'm using feathers-mongoose adapter and here is my adapter and model code
import mongo from 'mongoose'
import { logger } from './logger.js'
export const mongoose = (app) => {
/**
* @deprecated `strictQuery` option will be switched back to false
* by default in mongoose 7
*
*/
mongo.set('strictQuery', false)
mongo.connect(app.get('mongodb'), {
useNewUrlParser: true,
useUnifiedTopology: true,
}).catch((err) => {
logger.error(err);
process.exit(1);
});
app.set('mongooseClient', mongo);
};
then i have, initialised it by calling the app.configure(mongoose) in app.js file
Expected behavior
It should return the list of entities when i call the service from REST endpoint or call app.service('vendors').find()
Actual behavior
error: BadRequest: Invalid query parameter $select
at new BadRequest (/Users/kiranmaniya/Projects/node/store/node_modules/feathers-mongoose/node_modules/@feathersjs/errors/lib/index.js:86:17)
at /Users/kiranmaniya/Projects/node/store/node_modules/feathers-mongoose/node_modules/@feathersjs/adapter-commons/lib/filter-query.js:45:27
at /Users/kiranmaniya/Projects/node/store/node_modules/feathers-mongoose/node_modules/@feathersjs/commons/lib/utils.js:16:45
at Array.forEach (<anonymous>)
at Object.each (/Users/kiranmaniya/Projects/node/store/node_modules/feathers-mongoose/node_modules/@feathersjs/commons/lib/utils.js:16:30)
at cleanQuery (/Users/kiranmaniya/Projects/node/store/node_modules/feathers-mongoose/node_modules/@feathersjs/adapter-commons/lib/filter-query.js:39:21)
at filterQuery (/Users/kiranmaniya/Projects/node/store/node_modules/feathers-mongoose/node_modules/@feathersjs/adapter-commons/lib/filter-query.js:91:20)
at VendorService.filterQuery (/Users/kiranmaniya/Projects/node/store/node_modules/feathers-mongoose/node_modules/@feathersjs/adapter-commons/lib/service.js:46:51)
at VendorService._find (/Users/kiranmaniya/Projects/node/store/node_modules/feathers-mongoose/lib/service.js:65:47)
at callMethod (/Users/kiranmaniya/Projects/node/store/node_modules/feathers-mongoose/node_modules/@feathersjs/adapter-commons/lib/service.js:13:22)
Steps to reproduce
I have a plain service like this.
and i have registered the service, in most common way. I'm using
feathers-mongoose
adapter and here is my adapter and model codeand here is how i initialized the client
then i have, initialised it by calling the
app.configure(mongoose)
in app.js fileExpected behavior
It should return the list of entities when i call the service from REST endpoint or call
app.service('vendors').find()
Actual behavior
System configuration
Tell us about the applicable parts of your setup.
Module versions (especially the part that's not working): "@feathersjs/adapter-commons": "^5.0.0", "@feathersjs/authentication": "^5.0.0", "@feathersjs/authentication-client": "^5.0.0", "@feathersjs/authentication-local": "^5.0.0", "@feathersjs/authentication-oauth": "^5.0.0", "@feathersjs/configuration": "^5.0.0", "@feathersjs/errors": "^5.0.0", "@feathersjs/express": "^5.0.0", "@feathersjs/feathers": "^5.0.0", "@feathersjs/schema": "^5.0.0", "@feathersjs/socketio": "^5.0.0", "@feathersjs/transport-commons": "^5.0.0", "@feathersjs/typebox": "^5.0.0", "compression": "^1.7.4", "feathers-mongoose": "^8.5.1", "mongoose": "^6.10.4", "mongoose-schema-jsonschema": "^2.0.2", "slugify": "^1.6.5", "vhost": "^3.0.2", "winston": "^3.8.2"
NodeJS version: v16.20
Operating System: MacOS Ventura