Struggling to locate all elements within a MongoDB TypeORM database collection

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

Answer №1

The problem lies in the naming convention of totalItems and isListed. After switching to snake case, everything started working smoothly.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Interacting with a Web Socket Connection While Editing Inline Content Causes Distractions. Using Angular 9 Material Table

Not exactly an error-related inquiry, but more about behaviors. In my Angular 9 setup using RxJS and Material, I have a table connected to a web socket for updates triggered by blur or change, depending on the column. This setup works well, updating the ta ...

struggling with handling form data in Express/Node application

Currently this is my setup: Below is the Post method I am using app.post('/barchartentry', function(req, res){ res.render('barchart', { title: 'EZgraph: Bar Chart', barValues: req.body.myInputs, labelValues: req.body ...

Interactive feature on Google Maps information window allowing navigation to page's functions

Working on an Angular2 / Ionic 2 mobile App, I am utilizing the google maps JS API to display markers on a map. Upon clicking a marker, an information window pops up containing text and a button that triggers a function when clicked. If this function simpl ...

Creating a module within a component in angular - step by step guide

I am interested in dynamically creating a component inside another component. This will allow me to pass my dynamic HTML template directly to the decorator like this: //code /** * @param template is the HTML template * @param container is @ViewChild(& ...

Is there a specific MongoDB query that can identify when the same value appears multiple times within an array?

Consider the following example documents stored in a MongoDB database { "mylist":[ {"value": 1}, {"value": 2}, {"value": 3} ] }, { "mylist":[ {"value": 1}, {"value": 2}, {"value": 1} ] } Is ...

I'm confused as to why I am receiving the error stating that `kafka.Client` is not a constructor when the proper way to establish a Kafka connection is through `npm kafka-node`

What could be causing the error stating that kafka.Client is not a constructor when following the npm kafka-node method for creating a kafka connection? The line causing the issue is: this.client = new kafka.Client(); Here is the entire constructor code ...

What strategies can be employed to maintain reliable datetime management for a reservation system operating in diverse time zones?

Looking at the big picture: An interesting scenario arises when a hotel owner specifies a time frame for booking reservations at a restaurant (5pm - 10pm). Along with this information, there is also a timezone provided to ensure that dates are displayed i ...

Angular2, multi-functional overlay element that can be integrated with all components throughout the application

These are the two components I have: overlay @Component({ selector: 'overlay', template: '<div class="check"><ng-content></ng-content></div>' }) export class Overlay { save(params) { //bunch ...

An API built with Mongoose, Express, and Node.js is currently only able to send a single image

I have a buffer array that needs to be converted into images and sent to the user. The issue is that the current code only sends one image: const express = require("express"); const asyncHandler = require("express-async-handler"); const ...

Troubleshooting: Passport.js Google OAuth 2.0 not functioning properly post-deployment

I have a unique MERN web application set up where the client is hosted on Netlify and the server on Heroku. Utilizing user authentication through Passport.js with Google OAuth 2.0, I've implemented a feature where successful logins redirect users to t ...

Tips for successfully interacting with dynamic text areas using Protractor:

My current project involves e2e testing for an Angular 4 application with Protractor. Despite my efforts, I am struggling to locate a unique id, class, name or text identifier for a specific textarea within the application code. I need assistance in find ...

Remove an element from an array within an object stored in a MongoDB document

Greetings and thank you for taking the time to read my query! I am currently diving into the world of coding, and here's my first question on this platform: I have a MongoDB collection structured similarly to the example below. Each document represe ...

Angular's Integration with PayPal for Shipping Costs

I am facing an issue with my e-commerce website where the receipt only displays the total payment of the items purchased. I have searched for an SDK that supports Angular or TypeScript PayPal integration, but could only find one for JavaScript which did ...

The name "Identifier" has already been declared before

I am currently working on a social network project to enhance my skills in nodejs and reactjs. While debugging the backend code for /signin using Postman, I encountered an error that prevents me from launching the node server. The error message displayed i ...

Creating two number-like types in TypeScript that are incompatible with each other can be achieved by defining two

I've been grappling with the challenge of establishing two number-like/integer types in TypeScript that are mutually incompatible. For instance, consider the following code snippet where height and weight are both represented as number-like types. Ho ...

Retrieve the file using GraphQL resolve

Currently, I am developing an application utilizing these technologies: Backend: Mongoose Express Apollo GraphQL Frontend: Vuejs Apollo GraphQL I have managed to s ...

Can you explain the distinction between 'rxjs/operators' and 'rxjs/internal/operators'?

When working on an Angular project, I often need to import functionalities like the Observable or switchMap operator. In such cases, there are two options available: import { switchMap } from 'rxjs/operators'; or import { switchMap } from ' ...

Having trouble with VueJS ref not preventing the default form action on submit?

Within my <script> tag, I currently have the following code: render(createElement) { return createElement("form", {ref: "formEl" , on: {submit: this.handleSubmit} }, [ <insert create form inputs here> ]); } handleSubmit(e) { ...

Upgrade your development stack from angular 2 with webpack 1 to angular 6 with webpack 4

Recently, I have made the transition from Angular 2 and Webpack 1 to Angular 6 and Webpack 4. However, I am facing challenges finding the best dependencies for this new setup. Does anyone have any suggestions for the best dependencies to use with Angular ...

Typescript-enabled NodeJS REST client

I'm currently working on a nodejs web application using express and I want to access my API. I have experimented with various options, such as restangular and jquery ajax calls. Can anyone recommend some reliable REST client libraries with TypeScrip ...