i m newer wit meteor … i need to connect my existng mongo data base with meteor app
this is my DB (extenal )
> show dbs
items 0.000GB
local 0.000GB
nodeauth 0.000GB
nodeblog 0.000GB
> use items
switched to db items
> show collections
items
>
> db.items.find().pretty()
{
"_id" : ObjectId("57e2d776282dce039fb6d3e2"),
"title" : "this is title 00",
"cteateAt" : ISODate("2016-09-21T18:54:46.294Z")
}
>
i added example value
i run this on terminal to connect DB inside meteor application
channasmcs@channasmcs-Inspiron-N5110:~/Documents/Meteorss/hello_01$ MONGO_URL="mongodb://localhost:27017/items"
channasmcs@channasmcs-Inspiron-N5110:~/Documents/Meteorss/hello_01$ meteor
[[[[[ ~/Documents/Meteorss/hello_01 ]]]]]
=> Started proxy.
=> Started MongoDB.
=> Started your app.
=> App running at: http://localhost:3000/
this is my DB connect meteor code
import { Template } from 'meteor/templating';
import { ReactiveVar } from 'meteor/reactive-var';
import './main.html';
//$export MONGO_URL="mongodb://localhost:27017/items";
Items = new Mongo.Collection('items');
console.log(Items);
Template.body.helpers({
items: function(){
// Items.insert({title:"this is title 04",cteateAt:new Date()});
return Items.find();
}
});
this is my HTML OUTPUL
<body>
<ul>
{{#each items}}
{{> main}}
{{/each}}
</ul>
</body>
<template name="main">
<li> {{title}}</li>
</template>
when i compile this is out put is empty
this is my console log staus
( in console.log()
M…o.Collection {_transform: null, _connection: Connection, _collection: LocalCollection, _name: "items", _driver: LocalCollectionDriver…}_collection: LocalCollection_connection: Connection_driver: LocalCollectionDriver_insecure: undefined_makeNewID: ()_name: "items"_prefix: "/items/"_restricted: false_transform: null_validators: Object__proto__: Object
i think my DB conenct is wrong howe solve this ??