When utilizing the find
and findOne
methods to retrieve data from a collection, not all items are being returned.
Collection.ts
@Entity()
export class Collection {
@ObjectIdColumn()
id !: string ;
@Column()
symbol !: string
@Column()
name !: string
@Column()
description !: string
@Column()
image !: string
@Column()
totalItems !: number
@Column()
website!: string
@Column ()
categories!: string[];
@Column()
stats!: Stats[];
@Column()
isListed!: boolean;
}
find.ts
const collection = getMongoRepository(Collection)
await collection.findOne({ where: { symbol : { $eq : symbol}}})
Result
Collection {
id: 6285e19cfc929d11a2ec35fd,
symbol: 'solpunks',
name: 'SolPunks',
description: 'SolPunks are one of the very first NFTs on the Solana blockchain. Each of these 10,000 SolPunks has attributes that make them unique according to a defined rarity system.',
image: 'https://bafkreiaoifjzhau3clwdbtap7mekvdardfg25xl24kbexc7syvws35ifk4.ipfs.nftstorage.link/',
website: '',
categories: [ 'pfps' ],
stats: null
}
Expected Result
Collection {
id: 6285e19cfc929d11a2ec35fd,
symbol: 'solpunks',
name: 'SolPunks',
description: 'SolPunks are one of the very first NFTs on the Solana blockchain. Each of these 10,000 SolPunks has attributes that make them unique according to a defined rarity system.',
image: 'https://bafkreiaoifjzhau3clwdbtap7mekvdardfg25xl24kbexc7syvws35ifk4.ipfs.nftstorage.link/',
website: '',
categories: [ 'pfps' ],
totalItems : 9999,
isListed : true,
stats: null
}
Issue
totalItems
and isListed
are missing