I am creating a collection of users with a full name (for example, Jose Osorio, Jose castro, John smith, Maria Smith), I need to create a search bar to find registered users by their first name or last name.
those. write in the search bar and I want to see Jose Osorio and Jose Castro.
I read about creating an index in a database, but it didn’t work, or I did it wrong, what can I do to solve this problem?
To add an index:
Meteor.startup(function () { Meteor.users._ensureIndex({ "fullname": 1}); });
and make a collector, see: https://atmospherejs.com/fourq/typeahead
rawCollection :
rawCollection
Products.rawCollection().createIndex({ "type": "text", "searchString": "text", "title": "text", "brand": "text", "description": "text" }, { "weights": { type: 5, brand: 4, title: 3, searchString: 3, description: 1 } });
, , , db.books.createIndex( { "category": 1 } ) mongo.
db.books.createIndex( { "category": 1 } )
Source: https://habr.com/ru/post/1607167/More articles:Download JS file using PhantomJS / CasperJS - javascriptIs it safe to use System.IO when working with files in Unity3d? - c #Winapi ListView Header Separator and Cell Alignment Problem LVS_EX_GRIDLINES - listviewCount throws six in python cube - pythonHow to set up the bokeh application so that it can be accessed over the Internet? - pythonhttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1607168/executorservice-seems-to-be-running-thread-on-the-ui&usg=ALkJrhjGnfZngMEKRlzkYqjhicutBPMzvwHow to handle Unterminated string exception correctly? - javaIs it possible to create a native video chat application with an Android phone using webrtc? - androidСложить штабель монады - haskellCorrect way to compile Ruby 2.2 with jemalloc and rbenv? - ruby | fooobar.comAll Articles