i have a problem with my app. When written this db.request.count(); on mongo shell i have 4, but when i written Request.find().count() in my js code i have 0. Someone can help me ?
Try using Request.count() instead of calling count() after find().
This is assuming the name of your model is Request.
The Mongoose documentation has examples here.
If you ran Request.find().count() on the client and got 0, it's most likely that your client-side code did not subscribe to the Request collection.
If you ran Request.find().count() on the server and got 0, make sure you connected to the correct database. I.e. Meteor creates its own Mongo instance on port 3001, whilst you may have been using a different database on 27017.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With