- new module:datastore/query(namespace, kinds) + new require("datastore/query")(namespace, kinds)
Example
+ + + + + +-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
[datastore/query](#module_datastore/query)
- Query object.
- callback `function` - The callback function.
**Example**
diff --git a/docs/html/connection-Token.html b/docs/html/connection-Token.html
index 89dd85e18f6d..fa51af0a06e2 100644
--- a/docs/html/connection-Token.html
+++ b/docs/html/connection-Token.html
@@ -96,6 +96,8 @@ id
projectId
Dataset ID. This is your project ID from the - Google Developers Console.
Dataset ID. This is your project ID from + the Google Developers Console.
namespace
Namespace to isolate transactions to.
var dataset = new Dataset({
- id: 'my-project',
+ projectId: 'my-project',
keyFileName: '/path/to/keyfile.json'
});
@@ -840,7 +872,7 @@ Create a query from the current dataset to query the specified kinds.
+Create a query from the current dataset to query the specified kinds, scoped +to the namespace provided at the initialization of the dataset.
Name | + + +Type | + + + +Description | +
---|---|---|
namespace |
+
+
+ + + +string + + + + | + + + +
+
+
+ optional
+
+
+
+
+
+ Optional namespace. |
+
kinds |
+
+
+ + + +string +| + +array + + + + | + + + +
+
+
+
+
+
+
+ Kinds to query. |
+
var query = dataset.createQuery(['Lion', 'Chimp']);
-var zooQuery = dataset.createQuery('zoo', ['Lion', 'Chimp']);
+ var query;
+
+// If your dataset was scoped to a namespace at initialization, your query
+// will likewise be scoped to that namespace.
+query = dataset.createQuery(['Lion', 'Chimp']);
+
+// However, you may override the namespace per query.
+query = dataset.createQuery('AnimalNamespace', ['Lion', 'Chimp']);
+
+// You may also remove the namespace altogether.
+query = dataset.createQuery(null, ['Lion', 'Chimp']);
@@ -1105,7 +1230,7 @@ Helper to create a Key object, scoped to the dataset's namespace by default.
+You may also specify a configuration object to define a namespace and path.
+var key;
+
+// Create a key from the dataset's namespace.
+key = dataset.key('Company', 123);
+
+// Create a key from a provided namespace and path.
+key = dataset.key({
+ namespace: 'My-NS',
+ path: ['Company', 123]
+});
+
+
+
+options
Configuration object.
+ + +Name | +Type | @@ -341,6 +384,8 @@|||||
---|---|---|---|---|---|---|
path |
+
@@ -362,7 +407,43 @@ repeatable -Key descriptors. |
+ |||||
namespace |
+
+
+ + + +string + + + + | + + + +
+
+
+ optional
+
+
+
+
+
+ Optional namespace. |
+
var anInteger = dataset.int(7);
-
-
-
-var key = dataset.key('Company', 123);
+ var anInteger = dataset.int(7);
@@ -676,7 +603,7 @@ Sort the results by a property name ascendingly or descendingly.
+Sort the results by a property name ascendingly or descendingly. By default, +an ascending sort order will be used.
Reference: http://goo.gl/mfegFR
order
property
Operator (+, -) + property to order by.
Optional operator (+, -) and property to order by.
// Sort by size ascendingly.
-var companiesAscending = companyQuery.order('+size');
+var companiesAscending = companyQuery.order('size');
// Sort by size descendingly.
var companiesDescending = companyQuery.order('-size');
@@ -1438,7 +1471,7 @@ Check if an object is of the given type.
+Name | + + +Type | + + + +Description | +
---|---|---|
value |
+
+
+ + + +* + + + + | + + + +
+
+ Value to compare to. |
+
type |
+
+
+ + + +string + + + + | + + + +
+
+ Type to check against object's value. |
+
is([1, 2, 3], 'array');
+// true
+
+
+
Convert an object into an array.
+Name | + + +Type | + + + +Description | +
---|---|---|
object |
+
+
+ + + +object + + + + | + + + +
+
+ Object to convert to an array. |
+
function aFunction() {
+ return toArray(arguments);
+}
+
+aFunction(1, 2, 3);
+// [1, 2, 3]
+
+
+