Question: I'm using angular's getLocaleDateTimeFormat function to display selected date-time in the input field.

`getLocaleDateTimeFormat(this.injector.get(LOCALE_ID), FormatWidth.Short)` function shows `{1}, {0}`

but when i use  

`getLocaleDateFormat(this.injector.get(LOCALE_ID), FormatWidth.Short)` and `getLocaleTimeFormat(this.injector.get(LOCALE_ID), FormatWidth.Short)` each separately they display date and time properly.

Am i doing something wrong?

My function is:

`
formattingDate(date: Date): string {

```
if (!date || typeof date == 'string') {
    return '';
}

let localeId = this.injector.get(LOCALE_ID);

let localeDateFormat = getLocaleDateFormat(localeId, FormatWidth.Short);
let localeTimeFormat = getLocaleTimeFormat(localeId, FormatWidth.Short);
let localeDateTimeFormat = getLocaleDateTimeFormat(localeId, FormatWidth.Short);
return formatDate(date, localeDateTimeFormat, localeId);

```

}
`

the thing is getLocaleDateTimeFormat function is not getting date or time or both from date argument

Answer: 
**Use Projections to Return Only Necessary Data**
When you need only a subset of fields from documents, you can achieve better performance by returning only the fields you need:

For example, if in your query to the posts collection, you need only the timestamp, title, author, and abstract fields, you would issue the following command:

```
db.posts.find( {}, { timestamp : 1 , title : 1 , author : 1 , abstract : 1} ).sort( { timestamp : -1 } ).limit(10)

```

You can read for Query optimize [here](https://docs.mongodb.com/manual/tutorial/optimize-query-performance-with-indexes-and-projections/)
Make sure it's not a connection issue. Try to run your query from MongoDB shell

```
mongo mongodb+srv://${process.env.MONGO_USER}:${process.env.MONGO_PASSWORD}@cluster0-vuauc.mongodb.net/${process.env.MONGO_DB}?retryWrites=true&w=majority
db.collection.find({condition}).limit(10)

```

If in MongoDB shell it responds *faster* than Mongoose:

There is an issue for `Node.js` driver which uses pure Javascript [BSON serializer](https://stackoverflow.com/questions/36767310/why-is-json-faster-than-bson-in-node-js) which is very slow to serialize from BSON to JSON. 

Try to install `bson-ext`

> 
> The `bson-ext` module is an alternative BSON parser that is written in `C++`. It delivers **better deserialization performance** and similar or somewhat better serialization performance to the pure javascript parser.
> 
> 
> 

<https://mongodb.github.io/node-mongodb-native/3.5/installation-guide/installation-guide/#bson-ext-module>