I subscribed and published as follows.
But one of the database documents is repeated in the subscription, while it has no _id and is not in the database !
this is publish :
import { Meteor } from "meteor/meteor";
import {Article} from "../../Collections/Article/Article";
Meteor.publish('Pages.Articles', function() {
return Article.find({});
});
this is Subscribe :
// Subscribe Data
const ArticlesContainer = withTracker(() => {
const handle = Meteor.subscribe('Pages.Articles');
const loading = handle.ready();
if(loading){
const data = ArticleCollection.find({}, { sort: { createdAt: -1 } }).fetch() ;
return {
data ,
loading
};
}
})(Articles);
// For Redux
const MapStateToProps = state => {
return {
HasUser : state.HasUser
}
}
// Connect To Reducer
export default connect(MapStateToProps)(ArticlesContainer);
And i handle the Data as Follow :
{ this.props.data
?
this.props.data.map((article , index) => <Article key={index} title={article.title} img={article.img} />
:
''
}