0
I have an error trying to run a filter in the database.
var params = '{"cd_entidade":"'+ vcd_entidade+'"}';
Movmaterial.find(params).toArray(function(err,docs){
if (err) throw err;
console.log(docs);
}
an error has occurred that I am unable to resolve, it already has two days :( could you help me? I am creating a personal project for studies of the use of mongodb, I thank you
What’s wrong with you?
– Leite
find(...). toArray is not a Function at Object.index
– Gerci Lisboa
Movmaterial
is your mongodb? The return is probably not valid for not being able to call thetoArray
, debug what thefind
returns. Or try doingfind({}).toArray
.– Leite
thanks for the interest, come on..
– Gerci Lisboa
Movmaterial is mongodb and works when I do it as follows: Movmaterial.find({cd_entity:vcd_entity},Function(err,Docs){.. when I put inside a variable does not work. this is just an example, as I will include more arguments to better filter the data.
– Gerci Lisboa
I have tried to put it in the suggested way and the error it generated was: Typeerror: Movmaterial.find(...). toArray is not a Function at Object.index
– Gerci Lisboa
so that I have sent now, no error, you have selected all Collection data. The problem is that you didn’t filter the data, processed all the documents in the console.log.
– Gerci Lisboa