What is the difference between [Document,Document] and [{},{}] with meteorjs?

I’m using useTracke r and what is the difference between [Document, Document] and [{},{}] ?

const sample1 = useTracker(() => {
// …   
return Collection1.find({}).fetch() 
})

console.log(sample1) 
//  [Document,Document] 
// 0:Document {_id:’1223123’, name:’sample’}
// 1:Document {_id:’1211111’, name:’sample2’}
const sample2 = useTracker(() => {
// …   
return Collection2.find({}).fetch() 
})

console.log(sample2) 
// [{},{}]
// 0: {_id:’456456’, name:’sample’}
// 1: {_id:’654654’, name:’sample2’}

Both are getting documents but sample1 has Document letter and sample2 doesn’t.

It seems likely you’ve attached a transform function to one and not the other, which is transforming the raw object into an instance of Document.

More explicitly - something is setting the __proto__ to Document.prototype

2 Likes