0
I don’t know why when I config with mongoose plugin but public/subscribe with mongo on local it work fine but when I deploy my app on cloud server it not work. Please help or any suggestion. my collection
import { Mongo } from 'meteor/mongo'
const ItemMovements = new Mongo.Collection('pos_itemMovements')
export default ItemMovements
this is my public
import { Meteor } from 'meteor/meteor'
import ItemMovement from '../item-movement-pub-sub'
Meteor.publish('pos.itemMovementAlert', branchId => {
return ItemMovement.find({toBranchId: branchId,status: 'Open',})
})
This my subscribe
import moment from 'moment'
import ItemMovements from '../../api/item-movements/item-movement-pub-sub'
const productMovementAlertMixin = {
meteor: {
$subscribe: {
'pos.itemMovementAlert': function () {
return [this.currentBranchId]
},
},
productTransferNotify() {
let items = ItemMovements.find({
toBranchId: this.currentBranchId,
status: 'Open',
}).fetch()
let data = []
items.forEach(o => {
let doc = {
title: `Product Transfer: ${moment(o.tranDate).format(
'DD/MM/YYYY'
)} | ${o.total} ${this.baseCurrency}`,
// icon: 'fas fa-bell fa-lg',
route: {
name: 'PosItemMovementAcceptForm',
query: { moveId: o._id, actionType: 'Open' },
},
}
data.push(doc)
})
return data
},
},
}
export default productMovementAlertMixin
This is mongoose config
import { Meteor } from 'meteor/meteor'
import Mongoose from 'mongoose'
// const HOST = 'localhost'
const HOST = 'mongodb'
const PORT = 27017
const DB_NAME = 'pos-beer'
const mongoose = Mongoose.connect(`mongodb://${HOST}:${PORT}/${DB_NAME}`, {
useNewUrlParser: true,
useCreateIndex: true,
useUnifiedTopology: true,
})
export default mongoose
Meteor.startup(() => {
// Mongoose connection
mongoose
.then(() => {
console.log('Mongoose connected...')
})
.catch(err => {
console.log('Mongoose unable to connect: ', err)
})
})
I test on local with fine but on server data not react please help