findOne don't return all fields


With the function findOne(), not every fields are returned.


OR the insert function remove some fields despite {validate : false}

It’s very weird. Do you know how the problem could be ?
I use aldeed:collection2.

Thanks you !

Is this on the client or server?

Have you used the mongo shell to confirm the fields are definitely present?

This is on the server during unit tests. Can’t see the MongoDB collections :confused:

aldeed:collection2 is able to mutate documents when they are written to the database (“cleaning”) if they don’t conform to the schema. That means they may not contain all the fields you tried to include. You should check your schema. Alternatively, you can disable cleaning.

If you use the mongo shell you can verify that what you expect to be inserted has been written to the collection.