I am trying to learn using Meteor raw Collections with aggregate and grouping on server.
I’ve been testing the results with Meteor Shell running queries and results are just printed out…
This is the query:
db.tariff_types.aggregate([{$match:{Package:false}},{$group: {_id : "$RoomId", HotelId : { $first: "$HotelId" }, MinPrice: {$min: "$Price" }}},{$sort:{HotelId:1}}]);
Now I am moving to the actual application and trying to see results with console.log on localhost server but I can’t get the same results. This is what I am using:
var TariffTypesRaw = TariffTypes.rawCollection();
var TariffsInChannelRaw = TariffTypesRaw.aggregate([{$match:{Package:false}},{$group: {_id : "$RoomId", HotelId : { $first: "$HotelId" }, MinPrice: {$min: "$Price" }}},{$sort:{RoomId:1}}]);
console.log("TariffsInChannelRaw",TariffsInChannelRaw);
However it does not print result. Instead it print something I don’t understand:
I20180602-10:56:39.645(-3)? TariffsInChannelRaw Readable {
I20180602-10:56:39.654(-3)? pool: null,
I20180602-10:56:39.658(-3)? server: null,
I20180602-10:56:39.659(-3)? disconnectHandler:
I20180602-10:56:39.660(-3)? { s: { storedOps: [], storeOptions: [Object], topology: [Object] },
I20180602-10:56:39.661(-3)? length: [Getter] },
I20180602-10:56:39.662(-3)? bson: {},
I20180602-10:56:39.662(-3)? ns: 'meteor.tariff_types',
I20180602-10:56:39.663(-3)? cmd:
I20180602-10:56:39.664(-3)? { aggregate: 'tariff_types',
I20180602-10:56:39.666(-3)? pipeline: [ [Object], [Object], [Object] ],
I20180602-10:56:39.669(-3)? cursor: { batchSize: 1000 } },
I20180602-10:56:39.670(-3)? options:
I20180602-10:56:39.672(-3)? { readPreference: { preference: 'primary', tags: undefined, options: [Object] },
I20180602-10:56:39.673(-3)? promiseLibrary:
I20180602-10:56:39.674(-3)? { [Function: Promise]
I20180602-10:56:39.675(-3)? Fiber: [Object],
.....
How do I check results on server?