In Ottoman, how do a I create an index where I can return matches on any of the components of name? Is this something that can be done with a view or does it require N1QL? (Not played with that yet)
Extending this, how do I then return results for partial matches on each field?
Lastly, can anyone point me to docs and/or examples for creating queries: in Ottoman. http://ottomanjs.com/ doesn’t have enough for me to get my head around it.
You should be able to specify an index on the name field itself. Once you have done this, N1QL should provide indexing capabilities on the whole block. For instance:
Thanks @brett19. How do I get that work if I just supply a single string to search on against all fields in name? (I don’t always know what field the string I’m searching for will be in so want to search all fields in name
ie. If I made a call like User.findbyName( 'John', (err, rows) => {}); would it search for that string in all of name.first, name.last and name.display fields?
btw: How do I do partial string matches (ideally regex) in a find, ie. search for Bre*?
Ottoman does not currently support the kind of query you are looking to do. The second iteration of Ottoman does have support for a simple version of what you are trying to do, but we do not yet have a stable release.