Hello,
I’m just beginning to learn Couchbase, so if my question seems like I’m fundamentally misunderstanding something, please correct me!
I have a set of documents containing lines of text. Each line is four or five words long.
I want to create a view where the ID of each result is a hash of a line and who’s data contains the text of the line, as well as the hash of the line before and after. Something like this:
Key: 742929dcb631403d7c1c1efad2ca2700,
Value: {
Text: ‘chicken’,
PrevKey: d9f4b96fcf222c8fd607c101756b2303,
NextKey: c2e055acd7ea39b9762acfa672a74136
}
I have a few questions about this:
- First, I’m no stranger to Javascript, but I’m not sure the right way to make a hash of a string. Should I write a function in the body of the Map, or is there a way to import a hashing library?
- Second, Lets say the same line of text occurs multiple times. Can I have multiple results in a view with the same ID? Is that antipattern?
Thanks very much!
-Dave