Hey everyone, in this video I will show you how we can do the bisimulation for the post.
Okay, I want to do it similar with the five books.
Our review infinite scroll right in the front end.
I will show you how we can integrate us right now let's focus in the API part.
So how do we do that?
Well, if you know Azure you already know, uh, something like language and vice versa right.
Like that okay.
It will do some visualization using this way.
But it's not good for those application right now okay.
If you remember in MongoDB we have some method to do the skip.
Let me say right here we have something called skip.
Okay.
And we have a limit also with this approach it very bad performance when we use the skip over here okay.
And it not good for infinite scroll.
So for that reason we need to another way.
Okay.
Right now let me show you how we can do that.
I want to do similar.
First of all right here we have a limit.
Okay.
Maybe I remove the limit one.
And when I find that I will start from decrement with the created add.
okay.
Possible.
Right here and right here.
Let me say.
Okay.
This here will be the new one.
Okay.
So for that reason, we need to shortly.
But first let me show you.
Firstly I will show.
Up with a minus one.
Uh, actually I will.
So let us.
Okay.
Let me say.
This year will be the new one.
It later I will add the limit.
For example, I limit one okay I will, it will take one recourse and I will take a look at the created
order here.
I will copy that and I will put that inside the cursor cursor.
With something like this.
And I will say after I say I will file with the less than operator to file the another object.
Okay.
Right now it is not clear.
I will show you it got and I will explain okay.
Don't worry if you don't understand right now.
Firstly we need the source right?
And we need the limits also.
And.
Um.
We will screen.
Memory limits will be ten bucks.
Okay.
And I will fix the controller a little bit inside the box.
Controller over here.
Inside.
Get get all.
We need to vote with the query.
Okay.
We will request.
And request right here.
We raise the bar and make sure this is the number we can pass into the pie.
Okay.
We need to move the limits over here.
And one more thing will be the cursor.
Cursor.
I will remove Here.
We go.
I knew that if I won, let me go solo for you.
What is the limit?
Limit?
And.
From here, if I send with this information.
Okay, this is the query.
Okay.
Let's say right here, you can say we have a limit.
And right by this information I will show you we have a source.
We have a limit.
Right now I will limit with the limit right here.
And I will block one.
And I will show you why we need the plus one right here.
Don't worry.
After that.
We need the cross value.
So now we have a hash list by a not okay with this thing I will drag a box.
Not length.
Right run limit between.
Right here we have list by right.
And I will create an item.
The item we will have box.
We have set by.
If we have a hardness by we will use a box not slide we will remove.
The one from here.
And if not, we need to get the boss over here.
Okay, we already have a fast paced and agile, and in here we need to move a little bit.
One more thing.
We need to check if the cursor.
Is it okay, because, uh.
Is it?
We need to create a victory for us.
Where are we going to object?
I will put a little bit of script over here where we not created equal.
Let's not put a new line and move the cursor over here.
Okay.
And with the file method I will move that to.
I will move that over here right away.
And right now let me explain for you what actually happened right now.
Firstly not all this line.
Let me explain for you why we need two plus one.
We need two plus one because we want to check it has next bye or not.
Right.
For example, in here the boss right here is a limit.
Plus one possible limit will be ten.
Okay.
Ten plus one will be 11 and 11.
Also greater than Then Roy followed by Ruby become Joe and we call it Joe.
So for reasons we will extract from 1111 into the ten element, okay.
It means this line here it will be somehow got the one last element from the boss below here.
Because over here we start 11 element right.
So what is this guy?
We need to remove the last one.
Okay.
That is with this ten.
We can check it out.
Let's buy another an item.
And what is the final method right here.
Well, let me show you.
First one.
Um, certainly.
For example.
If we put the cursor right here, it means we want to do some visualization, right?
We want to pagination between right here we have a cursor.
And we will create a query for that cursor using the less than operator.
Okay.
First of all right now is uh.
Here.
Okay.
First of all this is the some days okay.
For example, this is the some timestamp or some days right here.
Firstly we will show we will show by from top to bottom something like this.
Right.
With this field it will start something like that.
And first of all with the limit will be one.
First of all, we would limit we reward whatever.
If the limit will be one, it will only return that this line.
Okay.
And we remove this line to the closure to very less.
Let me show you what exactly that right now I remove the limit will be one because right here we only
have two document.
Okay.
Right here I will say, uh, if we don't put anything, let's say.
Validation fail.
Or the reason?
Because right here it is.
Uh, empty string right here.
We need to put over here and let me remove.
We don't need that.
So.
Let me show you what exactly?
That.
Uh, but before that, let me use that.
Instead of using the box, I will using the icon.
Okay.
And, uh, instead of return here, I will return the box with the K.
And pass.
Let's marry.
And.
Okay, let me show you.
What?
Let me say.
Uh, we have some error.
Numeric number.
Integer.
Limit one to say we have our internal several.
Override our internal server.
Because right here we have a complete the transform detail.
Let let me comment that also I will show you how we can fix that.
Now let's say if I say we the limit will be one, we only get the one thing okay.
And right here we don't have a cursor, All right, we need to return the cursor.
Also the cursor right here.
It will come from the last item.
The last item.
Let me show you.
Sorry about the lag one dot created, huh?
Okay.
We need to return the cursor from the last one.
Right now it's a created app dot exit on file right here.
What about the schema?
The reason we call the boss right here.
It don't have created app field.
So I think I will provide right here.
Okay.
We already have a timestamp.
Right.
But let us.
Only for TypeScript once.
We don't need to boost the problem here.
Okay.
Because we already have a timestamp from the schema.
Okay.
This is just add a little bit of TypeScript.
Now it will fit TypeScript right?
Let me show you.
Now you can see this is the cursor right.
I want it will return the cursor for me.
Okay.
Now you can see this is the cursor.
Okay.
This is the cursor.
Right.
And in the next one, in order to vaccination I will put the cursor right here.
In the stage and say now you can say with certainty it will return from another culture.
And right now the database will be full.
This means we don't have any bias anymore, right?
So with this approach we can create the pagination using the cursor technique.
And it's very good for performance.
But what if and if you don't understand my explanation please check out the code.
And I'm sure you will because it doesn't hurt at all, right?
So it still is a right.
It's just the whole idea.
We need to leverage and shortcut using the created art field.
Okay, to do the pagination.
And one more thing.
We need to fix the radio.
Let me open again.
GitHub internal server error because in the most of it we already return the object.
Okay.
So we need to configuration a little bit inside Respondto.
Also inside the transform DTO.
Over here we have a map.
Right now let me console.log.
What is inside the data.
Right here we have a little bit error.
High altitude sky, which we should call.
This will be the data because for example, in in later if we have another uh, resource can pagination.
If we do the post we cannot reduce that.
Okay.
But let me show you what exactly what I mean.
For example, right here I will use the boss and inside the chart for me.
So let me go for use.
I will say it again.
We got the error but we already get the data right.
So here we will based on this field to know which will be the visualization or not, I will just give
the data has own property.
We will pass next by if it has led by it means this is the end point for the pagination, right?
So for that reason we need to return over here.
And uh data.
Data right here.
We need to destructuring.
Now for our data we have a post right.
We would go here and we need to pass the past next by and closure over here.
Right.
Something like that.
And we have some error.
We we need to use Roberto Tato has own property.
Okay.
We can use object dot.
Prototype dot has own property and we can call.
Him with the data and the field will be displaced by.
Okay.
It is exactly the same as before.
But this is the better in JavaScript.
Let me say it again.
Now we already got message.
Okay.
And we already provide a field for husk nest base and closure okay.
So this is what happens if I move this thing.
So.
Okay, we got the internal server error.
Let me test again a little bit more here.
It's work.
But if I move the cursor over here.
So what it is that we need to check a little bit over here.
Let's say we cannot wait for the uploaded file.
Right.
So for that reason, we need to check if has led by a withdrawal.
We will have a created app.
If not, we can put a note over here.
So it was more better.
And I think this will be very enough.
Okay.
You can check that if you want.
You can add a little bit of validation if you want.
But I think now you got the idea right.
So let's see what.
That's it and try to understand that.
And uh with this thing it's very easy, right?
We just need to add a little bit.
But like I said, if we call this here will be the post.
It cannot reduce it later.
Right.
Because for example, in later we have uh.
For example like the user roles or command or something like that.
Okay.
How do we Reviews so far is that we need to rename a little bit and in later make sure we always use
nickname.
I will call the items and right here we check it to.
Boost.
The item over here is much more better right?
This is the generic name.
Okay.
Let me say this.
The work pathway is okay.
And right now we have one more problem.
If we don't put anything inside here.
It will console.log the empty string.
So the reason is very simple.
The reason because the validation rule before it adds the default value.
So validation before routine we can move the default value higher.
Okay.
We can move the new operator.
Let me say.
We value we can move ten over here.
And let's try to remove that.
If we don't put anything let's say let y be same again.
Okay.
We already got information.
and hustled by for sure will be false.
And Kershaw will be low.
Right.
Now is.
Let me test one more time.
Will make only one say we got to console and that will be true.
Put the console over here.
Okay.
This orderly woke up.
We spotted.
And thus, for the video.
I hope you understand and talk a little bit of time to understand.
I will see you.