Collection Cbetween contains cascaded subdocuments, in which the List-type dataList field includes a series of strings, each of which has multiple numbers. You need to find strings according to the criterion that the first number is greater than 6154 and less than or equal to 6155.
Below is one of Cbetween’s subdocuments:
The eligible strings include “6154.5,37.9,1.529,1.429,1.429”,”6155,30.4,1.505,1.532,1.543″.
|3||=A2.conj((t=~.objList.data.dataList.new(~),t.select((s=#1.array@1()(1),s>6154 && s<=6155))))|
A1: Connect to MongoDB. The connection string format is mongo://ip:port/db?arg=value&…
A2: Retrieve data from MongoDB using find function and create a cursor. The name of the collection is Cbettwen. There is no filtering criterion. Retrieve all fields except _id field. Syntax of filtering criterion in esProc find function, which is similar to its MongoDB counterpart, follows MongoDB rules.
A3: Find the eligible strings. conj function concatenates results of filtering each subdocument in A2; ~ represents each member of an upper level of table sequence. new function is used to create a new table sequence and #1 represents the first field of the table sequence. array function can split a string into a sequence with comma being default delimiter; @1 means splitting the string into two members with the first delimiter being the boundary.
A4: Fetch cursor data in batches to get data from the memory. The result is as follows:
A5：Disconnect to MongoDB.