support
buy cialis buy valium online buy viagra online

Query List Fields in MongoDB Subdocuments in esProc

Problem source:https://groups.google.com/forum/#!msg/mongodb-user/HqzXSh5DZek/ffZG0TQ1w8cJ.

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:

esProc_NoSQL_mongodb_List_1

The eligible strings include “6154.5,37.9,1.529,1.429,1.429”,”6155,30.4,1.505,1.532,1.543″.

esProc code:

  A
1 =MongoDB(“mongo://localhost:27017/local?user=test&password=test”)
2 =A1.find(“Cbettwen”,,”{_id:0}”)
3 =A2.conj((t=~.objList.data.dataList.new(~),t.select((s=#1.array@1()(1),s>6154 && s<=6155))))
4 =A3.fetch()
5 =A1.close()

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:

esProc_NoSQL_mongodb_List_3

A5:Disconnect to MongoDB.

replica franck-muller watches  replica hublot watches  replica panerai watches  replica bvlgari watches  replica patek-philippe watches  replica montblanc watches  replica longines watches  replica hermes watches  replica audemars piguet watches  replica vacheron constantin watches