Tutorial by Examples: documents

lscount returns a time bucketed count of matching documents in the LogStash index, according to the specified filter. A trivial use of this would be to check how many documents in total have been received in the 5 minutes, and alert if it is below a certain threshold. A Bosun alert for this might ...
You can indent the text inside here documents with tabs, you need to use the <<- redirection operator instead of <<: $ cat <<- EOF This is some content indented with tabs `\t`. You cannot indent with spaces you __have__ to use tabs. Bash will remove empty space befo...
Taking a complex JSON document in a table: CREATE TABLE mytable (data JSONB NOT NULL); CREATE INDEX mytable_idx ON mytable USING gin (data jsonb_path_ops); INSERT INTO mytable VALUES($$ { "name": "Alice", "emails": [ "[email protected]", ...
curl -XGET 'http://www.example.com:9200/myIndexName/_count?pretty' Output: { "count" : 90, "_shards" : { "total" : 6, "successful" : 6, "failed" : 0 } } The index has 90 documents within it. Reference Link: Here
Example for searching multiple users with the name "Mike": $filter = ['name' => 'Mike']; $query = new \MongoDB\Driver\Query($filter); $cursor = $manager->executeQuery('database_name.collection_name', $query); foreach ($cursor as $doc) { var_dump($doc); }
curl -XGET http://www.example.com:9200/myIndexName/_search?pretty=true&q=*:* This uses the Search API and will return all the entries under index myIndexName. Reference Link: Here
Delete ALL documents with a 'farewell' property set to 'okay'. const MongoClient = require('mongodb').MongoClient; const url = 'mongodb://localhost:27017/test'; MongoClient.connect(url, function (err, db) { if (err) throw new Error(err); db.collection('myCollection').deleteMany(// M...
We are so used to the name D3.js that it's possible to forget that D3 is actually DDD (Data-Driven Documents). And that's what D3 does well, a data-driven approach to DOM (Document Object Model) manipulation: D3 binds data to DOM elements and manipulates those elements based on the bounded data. Le...
A document can be created by using the CreateDocumentAsync method of the DocumentClient class. Documents are user defined (arbitrary) JSON content. async Task CreateFamilyDocumentIfNotExists(DocumentClient client, string databaseName, string collectionName, Family family) { try { ...
DocumentDB supports rich queries against JSON documents stored in each collection. With a LINQ query IQueryable<Family> familyQuery = this.client.CreateDocumentQuery<Family>( UriFactory.CreateDocumentCollectionUri(databaseName, collectionName), queryOptions) .Where(f => f....
There are two basic ways in which you can Insert a document Create a document, Then insert it var bucket = cluster.OpenBucket("default"); var document = new Document<dynamic> { Id = "doc_net", Content = new { name = &quo...
cts:search( fn:doc(), cts:word-query("marklogic"))
This can be done in the following two ways - cts:search( fn:collection("first-collection"), cts:word-query("marklogic")) In this, the scope is changed from all the documents to documents in collection "first-collection" only. In the second approach, use ...
This query returns all the documents with element "company" and its value as "marklogic" cts:element-value-query(xs:QName('company'), 'marklogic'))
The following query returns the documents which have an element named "company" - cts:element-value-query( xs:QName('company'), '*', ("wildcarded"))) The following query returns the documents which have an element named "company" with an attribute named "name&...
R-markdown code chunks R-markdown is a markdown file with embedded blocks of R code called chunks. There are two types of R code chunks: inline and block. Inline chunks are added using the following syntax: `r 2*2` They are evaluated and inserted their output answer in place. Block chunks hav...
The XML document, I will be using throughout the examples is - <a> <b>test-value</b> <d>fragment-d</d> <c-root> <d>fragment-d</d> <e>fragment-e</e> </c-root> </a> The following queries ...
xdmp:estimate(cts:search(fn:doc(), cts:element-value-query(xs:QName("d"), "fragment-d"))) xdmp:estimate can not be used on XPaths unlike fn:count is used in previous example xdmp:estimate actually gives the number of matching fragments
The XML document to consider in this example - <a> <b>test-value</b> <d>fragment-d</d> <c-root> <d>fragment-d</d> <e>fragment-e</e> </c-root> </a> A fragment root is declared on <c-r...
To update multiple documents in a collection, set the multi option to true. db.collection.update( query, update, { upsert: boolean, multi: boolean, writeConcern: document } ) multi is optional. If set to true, updates multiple documents that meet the query crit...

Page 1 of 2