Hi,
I am new to Couchabse/NoSQL. I have a use case where I need to migrate an app from MySQL to Couchbase.
In MySQL i have a table with columns like startNumber,endNumber,LocationId
I fire a query as below- all values are long numbers
SELECT LocationId FROM blocks
WHERE {number} BETWEEN blocks.startNum AND blocks.endNum
LIMIT 1
where number is the runtime variable
In couchbase, I created a document with id being a GUID and LocationId, startNum and endNum being the JSON fields
How do i fire above query?
I am thinking on one option-
Create 2 views
view-1 - emit(doc.endNum , doc.LocationId );
View-2 emit(doc.startNum , doc.LocationId );
fire 2 queries, one on view-1 with startKeynumber
iterate thru fisrt set of records and find the locationId in second set of records, if find a match, stop.
Please note, range are not overlapping .example
0,5,99
6,10,100
11,15,101
16,20,102
21,25,103
26,30,104
But this means processing on application side. I want to process on couchbase server and give me a result, like MySQL