Mongoose find() returns a property of the model
ek
I am trying to find existing users using mongoose my query is
UserAccount.find(variables, function (error, success) {
if (error) {
response.send({status: false});
} else {
console.log(success);
}
});
Returns the following array if the user exists.
[ model {
'$__':
InternalCache {
strictMode: true,
selected: [Object],
shardval: undefined,
saveError: undefined,
validationError: undefined,
adhocPaths: undefined,
removing: undefined,
inserting: undefined,
saving: undefined,
version: undefined,
getters: {},
_id: 5c98e64f2106e94022532c9f,
populate: undefined,
populated: undefined,
wasPopulated: false,
scope: undefined,
activePaths: [StateMachine],
pathsToScopes: {},
session: null,
ownerDocument: undefined,
fullPath: undefined,
emitter: [EventEmitter],
'$options': [Object] },
isNew: false,
errors: undefined,
_doc:
{ isActive: true,
_id: 5c98e64f2106e94022532c9f,
userName: '[email protected]',
password:
'$2a$05$vpowA76cB3T/4eHGbQPqd.F/iIebX7SXKPZA2k1wcmlSIDks0q852',
userCategory: 'buyer',
createdDate: 2019-03-20T14:31:43.250Z,
updatedDate: 2019-03-20T14:31:43.250Z,
__v: 0 },
'$init': true } ]
I don't know what is causing this problem? Until yesterday, it only returned user data, but that's weird to me. how to solve this problem? Can someone help me with this problem? thanks.
Lokeshkumar S
I also faced the same problem, the probe is: if you are using the latest version of mongo and older mongoose, it can be solved by installing the newer version of mongoose and running mongoose find(), which will solve your probe problem.