| id | quickstart_v2 |
|---|---|
| title | Quickstart |
| sidebar_label | Quickstart |
Go to http://rvndb.ravencoin.online/v2/explorer and try the following queries. (Don't forget the "v": 2, this entire documentation is based on version 2.0, and the previous version has been deprecated)
Find all transactions where the first push data is "hello" in UTF8
{
"v": 2,
"q": {
"find": { "out.s1": "hello" },
"limit": 10
}
}
Find all transactions that start with "6d02" in hex as the first push data.
{
"v": 2,
"e": { "out.b1": "hex" },
"q": {
"find": { "out.b1": "6d02" },
"limit": 10
}
}
Find all transactions where one of its outputs starts with "6d02" in hex, but also includes the string "bet" in any of its output push data.
{
"v": 2,
"e": { "out.b1": "hex" },
"q": {
"find": {
"$text": {
"$search": "bet"
},
"out.b1": "6d02"
},
"limit": 10
}
}
It is possible to run regular expression matches on fields. But due to the way MongoDB works, running pure regular expression queries can be inefficient unless efficiently structured. (Related Article)
It is recommended that you use it in conjunction with a full text search to filter it down to a subset that matches the full text search results, and then apply the regex operation. (Also, make sure to read the linked article above)
Example: Find all transactions where the second push data matches the UTF8 regular expression /hello.*/i
{
"v": 2,
"q": {
"find": {
"$text": {
"$search": "hello"
},
"out.s2": {
"$regex": "hello.*", "$options": "i"
}
},
"limit": 10
}
}
Find all transactions sent from the address qq4kp3w3yhhvy4gm4jgeza4vus8vpxgrwc90n8rhxe
{
"v": 2,
"q": {
"find": {
"in.e.a": "qq4kp3w3yhhvy4gm4jgeza4vus8vpxgrwc90n8rhxe"
},
"limit": 10
}
}
Find all transactions sent from the address qq4kp3w3yhhvy4gm4jgeza4vus8vpxgrwc90n8rhxe and received by qpne29ue8chsv9pxv653zxdhjn45umm4esyds75nx6
{
"v": 2,
"q": {
"find": {
"in.e.a": "qq4kp3w3yhhvy4gm4jgeza4vus8vpxgrwc90n8rhxe",
"out.e.a": "qpne29ue8chsv9pxv653zxdhjn45umm4esyds75nx6"
},
"limit": 10
}
}
Find all transactions that contain an OP_RETURN output (output.b0 { op: 106 })
{
"v": 2,
"q": {
"find": {
"out.b0": {
"op": 106
}
},
"limit": 10
}
}
Find all transactions that contain Multisig transactions (output.b5 { op: 174 })
{
"v": 2,
"q": {
"find": {
"out.b5": {
"op": 174
}
},
"limit": 10
}
}
By default all queries return transaction objects since a "row" in RvnDB is a transaction. However we can take advantage of the flexible MongoDB queries to drill down into the matched subdocuments.
For example, if we were looking for a specific match in an output, we can ask the query to return the actual matched output instead of the full transaction, using MongoDB's project and $ operator:
{
"v": 2,
"e": { "out.b1": "hex" },
"q": {
"find": { "out.b1": "6d02" },
"limit": 10,
"project": {
"out.$": 1
}
}
}