简体   繁体   中英

how can I read values from a mongodb?

I'm using meteor as front end for my project and I'm using node.js & mongodb as back end. I have no idea about reading values in meteor. Please help me.

Try this code :

Pages = new Meteor.Collection("pages");
Meteor.startup(function () {
        if(Pages.find().count() === 0){
            var pages = JSON.parse(MY_JSON_LIST);
            for (page in pages) {
                    Pages.insert(pages[page]);
            }
        }
});

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM