Server-side searchBar / ListView

I’m looking for a way to display the huge list from the database and search in it.

The number of documents in the underlying MongoDB collection is huge and it’s not worth transferring all of them to the client side (time, traffic) and perform a search locally, so I’m looking how this could be done on the server side.

Specifically, I need to plug MongoDB code to the searchBar and when somebody starts typing in the searchBar, I will dynamically search in MongoDB, supplying 5 top documents back.

Need some guidance regarding where to start from.

1 Like

you can use virtual lists

http://framework7.io/docs/virtual-list.html

better is to create a app method to call the data as soon as the user begins to load your app.

data: function () {
  let data = {      
  route_root: '/some/real/path',
  image_root: '/image/path/',
 };
 data.list = undefined;

  return data;
 },
methods: {
setList: function(){
  if (app.data.myList === undefined){
    var ListP = fetch(my_ajax_url + '?controler=Somedata&action=getAllItemsList&userId='+userId)
    .then(function(response){
        return response.json();     
    }).then(function(json){
      app.data.myList = json.return;
    });
  }
 }
},

something like that.