Query Builder Question
See original GitHub issueHow to query a field inside array sub-document using ottoman query builder? How to add Collection name and scope name to query builder?`
import { Schema, Query, getDefaultInstance } from "ottoman";
const TestSchema = new Schema({
block1:{
field1:{type: String, required: true},
field2:{type: String, required: true}
},
block2:[{
field3:{type: String, required: true},
field4:{type: String, required: true}
}]
})
const ottoman = getDefaultInstance();
const query = new Query({}, 'bucketName.scopeName.collectionName');
const where_exp = {block2[{field3}]:{$eq: 'xyz'}};
const result = query
.select()
.where(where_exp)
.build();
console.log(result);
Source : forum post - https://forums.couchbase.com/t/how-to-query-a-field-inside-array-sub-document-using-ottoman-query-builder-how-to-add-collection-name-and-scope-name-to-query-builder/32978
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Query builder - Metabase
Create your question from scratch using the query builder interface. The query builder offers more flexibility for constructing a question: in addition to...
Read more >Newest 'query-builder' Questions - Stack Overflow
I am tring to trigger an event to save doctype data based on another doctype. This is how my doctype are: Employee has...
Read more >querybuilder basic question - Experience League Community
Answer to your queries inline in bold. Questions: None of the results are actually pages from the site? The site we have locally...
Read more >Questions and issues | laravel-query-builder - Spatie
Introduction · Requirements · About us ; Filtering · Sorting · Including relationships ; Extending query builder · Pagination · Front-end implementation ...
Read more >Frequently asked questions (FAQ) - Query Builder - Eurostat
Frequently asked questions (FAQ) - Query Builder · Query Builder · Frequently asked questions (FAQ) ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thanks
To query into array values use this way:
this will produce this valid N1Ql query
SELECT * FROM `travel-sample`.`inventory`.`hotel` WHERE ANY b IN block2 SATISFIES b.field3="xyz" END