javascript - Quering in a array/list in CouchDB -
I do not know how to implement the following question in Cochindi:
- < Chr.letter between two objects / diets is not same in code>
chr
and X , and - in the document boundary 200000 - 2000000, but I think it has to be done with
startkey
andendkey
to see it. "B01", "name": "A", "pos": 828288, "s_type": 1} "" _ "": "7"
, "Sub_name" "sub-name": "b101", "name": "a", "paus": 171878, "s_type": 3} the boundary range is not complete Document "10" is not valid, "A", "name": "A", "status": 871 9 63, "s_type": 3}
Is because chr.letter = X. and document 14 in chr.no = 6 is not valid, since chr.no = 5 and chr.no = 6 both have the same crossover .letter = G
< P> The following documents are in the database: {"_id": "10", "_rev": "301288068d2c4ef3e6a9d3f8ff4e3377dd", "sub_name": "B01", " Name ":" A "," pos ": 1932523," s_type ": 1," chr ": [{" letter ":" T "," no ": 4}, {" letter ":" A " {"_": "14", "_rev": "3-21300d06c31224416b8ff71b71b304d8", "no": 5}, {"letter": "x", "no": 6}], "type": "test" ",", "Name": "b1", "name": "a", "position": 667214, "s_type": 1, "chr": ["letter": "t", "no": 4} {"Alphabet": "g", "no": 5}, {"letter": "live", "no": 6}], "type": "test"} {"_id": "7" , "_rev": "2-1516ba547bdd21724158bc854f39f66b", "sub-name": "b101", "name": "a", "status": 828288, "type": "test": "{1}" , "Chr": [{"letter": "c", "no": 5}, {"letter": "T", "no": 6}]} {"_id": "8", "_rev ":" 2-750078ccc9e74616f33a2537e41b8414 "," sub-name ":" b101 "," name ":" a "," pause ": 171878," p "Type": "Test" "A", "T", "No": " Paus ": 871963," s_type ": 3," b "," name ":" b "," name ":" 3D 68352A2D98C56FD232A666FB7C38A "," All -N "Chr": ["alphabet": "a", "no": 5}, {"letter": "live", "no": 6}], "type": "test"}
The above databases are created with the following script:
import couchdb # $ sudo systemctl start couchdb # http: // localhost: 5984 / _utils / server = Couchdb Server () db = server.create ("test") # couchdb.http.ResourceConflict: #db = server ["test"] r = [["test", "a", "b01", 828288, 1, 7 , "C", 5], ["test", "a", "b101", 828288, 1, 7, 't', 6], ["test", "a", "b1 001", 171878 3, 8, 'C', 5], ["Test", "A", "B101", 3, 8, 'T', 6], ["Test", "A", "B 001" , "B101", 871963, "B", 171878, 3, 8, 'T', 6] 871 9 63, 3, 9, 'A', 5], ["Test", "A", "B1" "A", "A", "B" 1, 10, 'X', 6], ["Test", "A", "1", "A", "1", "1", "A" , "A", "B101", 1932523, 1, 10, B01 ", 667214, 1, 14, 'T', 4], [" Test "," A " , "B101", 667214, 1, 14, 'G', 5], ["Test", "A", "B 101", 667214, 1, 14, 'G', 6]] # _id = r None in: _id = str (i [5]) Doctor = db.get (_id) if not doctor I [2], 'pos': i [3], 's_type': i [4], I '_id': _id, 'chr': [] doctor ['chr']. Enclosed ({"letter": i [6], "no": i [7]}) Other: doctor ['chr'] . {"Letter": i [6], "no": i [7]}) db.save (doc)
How to execute the above queries or how to query the query Should be the structure to make possible?
for resolution
function (doc) {var judge = Function (doc) {var unexpect = "X"; Var letter1 = unexpected, letter2 = unexpected; For (doc.chr in var i) {var chr = doc.chr [i]; If (chr.no == 5) {letter1 = chr.letter; } And if (chr.no == 6) {letter2 = chr.letter; }} If (letter1! = Letter2 & Letter 1! = Unexpected & amp;; letter2! = Unexpected) {return true; } return false; }; If (the judge) {emit (doctor); }}
Comments
Post a Comment