Hello all,
I have a very simple query. I am working on getting up publish / subscribe up and running as part of my learining, and am stuck with it at the moment.
I have a new meteor app created, no amends made. I also have a new db collection called dummy. All it contains is one record.
meteor:PRIMARY> db.dummy.insert({"text" : "this is a test message"})
Server/main.js contains the below:
import { Meteor } from 'meteor/meteor';
import { Mongo } from 'meteor/mongo';
ServerDummy = new Mongo.Collection('dummy');
console.log("Server log follows...")
console.log(ServerDummy.find({}));
Client/main.js contains the below:
import { Template } from 'meteor/templating';
import { ReactiveVar } from 'meteor/reactive-var';
import { Mongo } from 'meteor/mongo';
import './main.html';
ClientDummy = new Mongo.Collection('dummy');
console.log(ClientDummy.find({"text" : "Another dummy line"}));
When I save it, Iām able to view the server side logs in the terminal. However, When I tried to view the client side logs in the browser, I only see āundefinedā. How exactly do I view the contents?
Secondly,
When I insert into the collection from server.js, the document looks completely different from the one I inserted directly in mongo shell. Could someone please explain what is going on?
server/main.js
ServerDummy.insert({"text" : "Another dummy record"});
My console looks like this:
=> Meteor server restarted
I20160526-14:17:29.525(5.5)? Server log follows...
I20160526-14:17:29.531(5.5)? db:
I20160526-14:17:29.531(5.5)? { domain: null,
I20160526-14:17:29.531(5.5)? _events: {},
I20160526-14:17:29.531(5.5)? _maxListeners: 10,
I20160526-14:17:29.531(5.5)? databaseName: 'meteor',
I20160526-14:17:29.531(5.5)? serverConfig: [Object],
I20160526-14:17:29.531(5.5)? options: [Object],
I20160526-14:17:29.532(5.5)? _applicationClosed: false,
I20160526-14:17:29.532(5.5)? slaveOk: false,
I20160526-14:17:29.532(5.5)? bufferMaxEntries: -1,
I20160526-14:17:29.532(5.5)? native_parser: false,
I20160526-14:17:29.532(5.5)? bsonLib: [Object],
I20160526-14:17:29.532(5.5)? bson: [Object],
I20160526-14:17:29.532(5.5)? bson_deserializer: [Object],
I20160526-14:17:29.532(5.5)? bson_serializer: [Object],
I20160526-14:17:29.532(5.5)? _state: 'connected',
I20160526-14:17:29.533(5.5)? pkFactory: [Object],
I20160526-14:17:29.533(5.5)? forceServerObjectId: false,
I20160526-14:17:29.533(5.5)? safe: false,
I20160526-14:17:29.533(5.5)? notReplied: {},
I20160526-14:17:29.533(5.5)? isInitializing: true,
I20160526-14:17:29.533(5.5)? openCalled: true,
I20160526-14:17:29.533(5.5)? commands: [],
I20160526-14:17:29.533(5.5)? logger: [Object],
I20160526-14:17:29.533(5.5)? tag: 1464252449432,
I20160526-14:17:29.534(5.5)? eventHandlers: [Object],
I20160526-14:17:29.534(5.5)? serializeFunctions: false,
I20160526-14:17:29.534(5.5)? raw: false,
I20160526-14:17:29.534(5.5)? recordQueryStats: false,
I20160526-14:17:29.535(5.5)? retryMiliSeconds: 1000,
I20160526-14:17:29.535(5.5)? numberOfRetries: 60,
I20160526-14:17:29.535(5.5)? readPreference: [Object] },
I20160526-14:17:29.535(5.5)? _primary: '127.0.0.1:3001',
I20160526-14:17:29.535(5.5)? _oplogHandle:
I20160526-14:17:29.536(5.5)? { _oplogUrl: 'mongodb://127.0.0.1:3001/local',
I20160526-14:17:29.536(5.5)? _dbName: 'meteor',
I20160526-14:17:29.536(5.5)? _oplogLastEntryConnection: [Object],
I20160526-14:17:29.536(5.5)? _oplogTailConnection: [Object],
I20160526-14:17:29.536(5.5)? _stopped: false,
I20160526-14:17:29.536(5.5)? _tailHandle: [Object],
I20160526-14:17:29.536(5.5)? _readyFuture: [Object],
I20160526-14:17:29.536(5.5)? _crossbar: [Object],
I20160526-14:17:29.537(5.5)? _baseOplogSelector: [Object],
I20160526-14:17:29.537(5.5)? _catchingUpFutures: [],
I20160526-14:17:29.537(5.5)? _lastProcessedTS: [Object],
I20160526-14:17:29.537(5.5)? _onSkippedEntriesHook: [Object],
I20160526-14:17:29.537(5.5)? _entryQueue: [Object],
I20160526-14:17:29.537(5.5)? _workerActive: false },
I20160526-14:17:29.537(5.5)? _docFetcher: { _mongoConnection: [Circular], _callbacksForCacheKey: {} } },
I20160526-14:17:29.537(5.5)? _cursorDescription:
I20160526-14:17:29.537(5.5)? { collectionName: 'dummy',
I20160526-14:17:29.538(5.5)? selector: { text: 'Another dummy line' },
I20160526-14:17:29.538(5.5)? options: { transform: null } },
I20160526-14:17:29.538(5.5)? _synchronousCursor: null }
I20160526-14:17:29.530(5.5)? { _mongo:
I20160526-14:17:29.530(5.5)? { _observeMultiplexers: {},
I20160526-14:17:29.530(5.5)? _onFailoverHook: { nextCallbackId: 0, callbacks: {}, bindEnvironment: true },
instead of just
I20160526-14:16:38.153(5.5)? Server log follows...
I20160526-14:16:38.160(5.5)? { _id: { _str: '5746a9f289519bc6a55891e7' },
I20160526-14:16:38.161(5.5)? text: 'this is a test message' }
Thanks