We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Having a mongoose model with attribute of type Map:
Map
module.exports = app => { const modelName = 'users'; const mongooseClient = app.get('mongooseClient'); const schema = new mongooseClient.Schema({ firstName: {type: String}, lastName: {type: String}, roles: { type: Map, of: Boolean }, meta: {type: Object} }, { timestamps: true, strict: false }); return mongooseClient.model(modelName, schema); };
And Class:
const {Service} = require('feathers-mongoose'); exports.Users = class Users extends Service {}
(Hooks are untouched)
Attribute roles should be returned as any other attribute.
roles
Attribute roles is being returned empty ("roles": {}), but logging context in after create hook shows roles being there (as a Map)
"roles": {}
after create
Module versions
{ "@feathersjs/authentication": "^4.5.11", "@feathersjs/authentication-local": "^4.5.11", "@feathersjs/authentication-oauth": "^4.5.11", "@feathersjs/configuration": "^4.5.11", "@feathersjs/errors": "^4.5.11", "@feathersjs/express": "^4.5.11", "@feathersjs/feathers": "^4.5.11", "@feathersjs/socketio": "^4.5.11", "@feathersjs/transport-commons": "^4.5.11", "feathers-mongoose": "^8.3.1", "mongoose": "^5.11.17" }
NodeJS version: node:14.15.3
node:14.15.3
The text was updated successfully, but these errors were encountered:
This was a dumb mistake of mine, all I had to add was schema.set('toObject', {flattenMaps: true}); into my model.
Sorry, something went wrong.
No branches or pull requests
Steps to reproduce
Having a mongoose model with attribute of type
Map
:And Class:
(Hooks are untouched)
Expected behavior
Attribute
roles
should be returned as any other attribute.Actual behavior
Attribute
roles
is being returned empty ("roles": {}
), but logging context inafter create
hook shows roles being there (as aMap
)Module versions
NodeJS version:
node:14.15.3
The text was updated successfully, but these errors were encountered: