0

I am using meteor.JS to develop simple app and i have some problem here.

In my app i defined collection like below and i published it from server side and subscribed it in client side

Product_Mobiles=new Meteor.Collection('product_mobiles');

while running the app in one terminal,from the other terminal i imported JSON file data to collection like

mongoimport --db meteor --host localhost:3002 --collection Product_Mobiles <products.json --jsonArray

that imports the objects well and my problem is,

when i try to call

db.Product_Mobile.find({});

this showing error db is not defined. that command is working well in meteor mongo shell and returning results.

But when i try this in JS file and while running the app it is showing db not defined and i tried to remove the db and run like

Product_Mobile.find({});(which i did to all my remaining collections and those are working well).

This is also showing error like Product_Mobile is not defined Am i doing anything wrong? Help me with this.

1

1 Answer 1

3

You should use the collection name you defined with Product_Mobiles=new Meteor.Collection('product_mobiles');

So you should use product_mobiles when you import something.

Additionally in meteor the commands aren't exactly the same as the mongo shell. You would use Product_Mobiles.find() instead, since you defined it earlier on. The db object is only something thats available in the mongo shell.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.