Skip to content

Is the Datastore Query object supposed to be immutable? #731

@callmehiphop

Description

@callmehiphop

At first glance I assumed that the Query class was supposed to be immutable -- each method creates a new query instance, copies all of the properties from the previous instance and then returns it.

However, I noticed that for methods that can be called multiple times (filter() and order()) it holds a reference to the previous instance.

e.g.

var query1 = new Query(['kind1']);
var query2 = query1.filter('count >', 5);

query1.filters.length; // => 1

Is this the desired functionality?

Metadata

Metadata

Assignees

Labels

api: datastoreIssues related to the Datastore API.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions