Query document with a query language
The usage of query language for example we have a document looks like the following
{ "firstName": "John", "lastName": "Doe", "age": 28, "pets": [ {"name": "Rexy rex", "kind": "dog", "likes": ["bones", "jumping", "toys"]}, {"name": "Grenny", "kind": "parrot", "likes": ["green color", "night", "toys"]} ] } Copy
{ "firstName": "John", "lastName": "Doe", "age": 28, "pets": [ {"name": "Rexy rex", "kind": "dog", "likes": ["bones", "jumping", "toys"]}, {"name": "Grenny", "kind": "parrot", "likes": ["green color", "night", "toys"]} ] }
const queryStr = '/* | limit 1'const resultSet = await queryDoc<Profile>(collection, queryStr) Copy
const queryStr = '/* | limit 1'const resultSet = await queryDoc<Profile>(collection, queryStr)
const queryByName = '/[firstname="John"]'const resultSet = await queryDoc<Profile>(collection, queryByName)const queryByFirstAndLast = '/[firstName="John"] and [lastName="Doe"]'const resultSet = await queryDoc<Profile>(collection, queryByName) Copy
const queryByName = '/[firstname="John"]'const resultSet = await queryDoc<Profile>(collection, queryByName)const queryByFirstAndLast = '/[firstName="John"] and [lastName="Doe"]'const resultSet = await queryDoc<Profile>(collection, queryByName)
// only query the firstName and lastNameconst queryByName = '/[firstname="John"] | / {firstName, lastName}'const resultSet = await queryDoc<Profile>(collection, queryByName) Copy
// only query the firstName and lastNameconst queryByName = '/[firstname="John"] | / {firstName, lastName}'const resultSet = await queryDoc<Profile>(collection, queryByName)
// only query the firstName and lastNameconst queryByNameAndCount = '/[firstname="John"] | count'const resultSet = await queryDoc<Profile>(collection, queryByNameAndCount) Copy
// only query the firstName and lastNameconst queryByNameAndCount = '/[firstname="John"] | count'const resultSet = await queryDoc<Profile>(collection, queryByNameAndCount)
the instance of collection
a document query string
Optional
an optional query parameters
the QueryResult
Generated using TypeDoc
Query document with a query language
The usage of query language for example we have a document looks like the following