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: 
MongoDB is very fast in the execution of queries. But it also depends on how you write your query. For getting the first 10 documents and sort it descending order to the \_id from a collection. You need to use `limit` & `sort` in your query.

```
db.collectionName.find({}).limit(10).sort({_id:-1})

```
**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/)