Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

query-engine

bevry291MIT1.5.7

Query-Engine is a NoSQL and MongoDb compliant query engine. It can run on the server-side with Node.js, or on the client-side within web browsers

coffeescript, query-engine, nosql, query, sql, pills, search, searching, lucene, filter, filtering, collections

readme

Query-Engine

Build Status NPM version Gittip donate button Flattr donate button PayPayl donate button

Query-Engine is a NoSQL and MongoDb compliant query engine. It can run on the server-side with Node.js, or on the client-side within web browsers

QueryEngine provides extensive Querying, Filtering, and Searching abilities for Backbone.js Collections as well as JavaScript arrays and objects. The Backbone.js and Underscore dependencies are optional.

Features

  • includes a live interactive demos with several examples, wiki documentation and source-code documentation
  • runs on node.js and in the browser
  • supports NoSQL queries (like MongoDB)
  • supports filters (applying a filter function to a collection)
  • supports search strings (useful for turning search input fields into useful queries)
  • supports pills for search strings (e.g. author:ben priority:important)
  • supports optional live collections (when a model is changed, added or removed, it can automatically be tested against the collections queries, filters, and search string, if it fails, remove it from the collection)
  • supports parent and child collections (when a parent collection has a model removed, it is removed from the child collection too, when a parent collection has a model added or changed, it is retested against the child collection)
  • actively maintained, supported, and implemented by several companies

Compatability

Tested and working against:

Using

View the Complete Query Engine Documentation on the Bevry Website

Install

Node

  • Use: require('query-engine')
  • Install: npm install --save query-engine

Browserify

Ender

  • Use: require('query-engine')
  • Install: ender add query-engine

Direct

  • Use: window.queryEngine or window.QueryEngine whichever you prefer
  • CDN URL: //bevry.github.io/query-engine/lib/query-engine.js

History

Discover the change history by heading on over to the HISTORY.md file.

Contribute

Discover how you can contribute by heading on over to the CONTRIBUTING.md file.

Backers

Maintainers

These amazing people are maintaining this project:

Sponsors

These amazing people have contributed finances to this project:

Become a sponsor!

Gittip donate button Flattr donate button PayPayl donate button

Contributors

These amazing people have contributed code to this project:

Become a contributor!

License

Licensed under the incredibly permissive MIT license

Copyright © 2012+ Bevry Pty Ltd us@bevry.me (http://bevry.me)
Copyright © 2011 Benjamin Lupton b@lupton.cc (http://balupton.com)

changelog

History

  • v1.5.7 December 21, 2013

    • Fixed wzrd.in support
  • v1.5.6 November 29, 2013

    • Fixed browserify support
  • v1.5.5 November 17, 2013

    • Added support for querying nested models and collections
  • v1.5.4 November 8, 2013

    • Added support for Exoskeleton
    • Added window.QueryEngine alias when using direct install method
    • Dropped component.io and bower support, just use ender or browserify
  • v1.5.3 October 27, 2013

    • Re-packaged
  • v1.5.2 March 21, 2013

    • Backbone peerDependency now supports any version
    • Tested again Backbone.js v1.0.0
    • Re-compiled with CoffeeScript 1.6.2 from 1.4.0
  • v1.5.1 January 24, 2013

  • v1.5.0 December 14, 2012

    • Removed backbone dependency, should now be handled by the parent project
    • Added support for Backbone v0.9.9 - backbone issue #1922 broke it
  • v1.4.1 December 14, 2012

    • Changed backbone dependency version from 0.9.x to 0.9.2 due to the b/c break
  • v1.4.0 November 5, 2012

    • Speed improvements
    • We now do compiled queries
    • Got rid of underscore dependency (still used in tests)
    • Backbone dependency is now optional on the client side
      • Backbone is required for the QueryCollection class
    • Criteria changes:
      • Constructor now accepts criteria options
      • applyCriteria renamed to applyCriteriaOptions
      • Added extractCriteriaOptions(criteriaOptions)
    • queryEngine changes:
      • Added setQuerySelector(selectorId, selectorObject) so you can add your own custom query selectors
      • Added testModels(models,criteriaOptions) so you can query standard javascript objects without backbone
  • v1.3.1 October 29, 2012

  • v1.3.0 October 29, 2012

    • Memory improvements
    • Speed improvements
    • Moved query criteria out of QueryCollection into new Criteria class
      • QueryCollection injects the Criteria prototype methods to stay backwards compatible
      • Introduced Criteria::testModels which is the same as query but returns the results instead of applying them
    • QueryCollection changes:
      • findAll, findAllLive, findOne and query can now accept a Criteria object in addition to what they could accept before
      • Added queryModels and queryArray that accept the same arguments as findAll, findAllLive and findOne
    • Updated dependencies:
      • underscore 1.4.x from 1.3.x
    • Updated dev dependencies:
      • coffee-script 1.4.x from 1.3.x
      • joe 1.1.x from 1.0.x
  • v1.2.7 August 10, 2012

    • Re-added markdown files to npm distribution as they are required for the npm website
  • v1.2.6 July 24, 2012

    • When a pill value receives true, false, or null as a string we will convert it to the non-string equivalent
    • safeRegex will now handle the non-string values of true, false and null properly
  • v1.2.5 July 24, 2012

    • Query Engine now handles null values correctly
  • v1.2.4 July 23, 2012

    • Fixed trickling of change events from parent collection to child collections
      • Before if a distant parent collection had a change event that removed or added the model from that event, that change would not be reflected in a distant child collection
  • v1.2.3 July 18, 2012

    • Fixed strings in some environments being split into arrays when using $has and $in
  • v1.2.2 June 21, 2012

    • Added $like, $likeSensitive, $bt, $bte, $eq, $mod, and $not queries
    • Added paging
  • v1.2.1 June 21, 2012

    • Added QueryCollection::findAllLive(query,[comparator]) shortcut for QueryCollection::createLiveChildCollection().setQuery('find',query).setComparator(comparator).query()
    • QueryCollection::findAll and QueryCollection::findOne now support an optional comparator argument as the second argument
    • QueryEngine comparators are now supported for
      • comparators passed through options
      • comparator prototype property on your own custom QueryCollection instance
  • v1.2.0 June 16, 2012

    • You can now pass the standard models, and options arguments to QueryCollection::createChildCollection and QueryCollection::createLiveChildCollection
    • If options.collection is specified when creating a child collection, it will be used as the child collectiont type
    • Restructured directories and files
    • Cleaned up demos and added two new demos: search and visual search
    • Updated search string syntax to be compliant with Visual Search's search string syntax
      • Adds support for quotes when using pills, e.g. user:"Benjamin Lupton"
      • Adds support for using pills of the same name multiple times, e.g. tag:node tag:query
        • Whether this ORs or ANDs is customisable via the pill's logicalOperator which can be AND or OR (defaults to OR)
    • Moved tests from Mocha to Joe
    • Added browser tests
  • v1.1.14 June 5, 2012

    • Fixed using arrays in queryEngine.generateComparator
  • v1.1.13 May 30, 2012

    • Made the query source code a bit more readable
    • Fixed $nor, $or, and $and queries
      • They also now support objects (instead of just arrays) as their values
    • Added queryEngine.toArrayGroup which returns an array, with an array item for each key-value pair in the object
  • v1.1.12 May 17, 2012

    • You can now specify the collection property inside your custom collection classes
      • If specified, it will be used as the class for child collections
  • v1.1.11 May 17, 2012

    • We now throw errors if QueryCollection::setFilter, QueryCollection::setQuery, and QueryCollection::setPill are called without both arguments
  • v1.1.10 May 17, 2012

    • Added sorting on change events if the collection is live
    • Fixed sorting by a value that could be 0
  • v1.1.9 May 17, 2012

    • Added
      • queryEngine.generatorComparator
      • QueryCollection::setComparator
      • QueryCollection::sortCollection
    • When creating a child collection, the parent collection's comparator will now be copied over
    • Comparators can now be arrays of comparators too
  • v1.1.8 May 15, 2012

    • Fixed boolean comparison
    • Now uses CoffeeScripts extends rather than Backbone.extend
  • v1.1.6 May 8, 2012

    • Cleaned the code up a little bit
    • Aliases $beginsWith with $startsWith, and $endsWith with $finishesWith
      • Which all now support array values, e.g. something: $beginsWith: ['a','b','c']
    • Exposes the used Backbone.js module through queryEngine.Backbone
      • You should use this instead of including your own backbone module due to this bug in Backbone.js
  • v1.1.4 and v1.1.5

    • Bugfixes
  • v1.1.3 April 19, 2012

    • For development, we've added CoffeeScript as a devDependency and added make dev to keep the compiled Query-Engine up to date using it
    • Query-Engine for Node now includes the compiled Query-Engine code, rather than the source CoffeeScript version
      • This means you no longer have to require('coffee-script') just to use Query-Engine with Node
    • Thanks to Farid Neshat for the pull requests
  • v1.1.2 April 6, 2012

    • Fixed reset on a parent collection not triggering the appropriate handler for a live child collection
    • Updated the demo with better styling and horizontal columns now instead of vertical
    • Added way more unit tests for live parent collections and live events
    • Added createLiveChildCollection to QueryCollection
  • v1.1.1 April 2, 2012

    • Fixed the ability to specify filters, queries and pills via options
    • Fixed an issue with pills and searching
  • v1.1.0 April 2, 2012

    • Upgraded Mocha to v1.0.0 from v0.14.0
    • Updated Backbone.js to 0.9.2 from 0.9.1
    • Merged BaseCollection and LiveCollection into QueryCollection
    • Added live([true/false]) to QueryCollection
      • Use this to subscribe to events on your collection and parent collection
    • Renamed createLiveCollection to createChildCollection on QueryCollection
    • Renamed find to findAll on QueryCollection to not conflict with Backbone's find command
  • v1.0.0 March 14, 2012

    • Large rewrite, and backwards compatibility breaking release
    • Introduces the dependencies:
    • Introduces these features:
      • Live Collections
        • Live Collections, instead of re-querying everything when something changes, instead we test a model when it is added or changed. This means that our live collections are always in the correct state, and update dynamicly.
        • They also support binding to a parent collection
      • Queries
        • These are the v0.x NoSQL type queries
      • Filters
        • These are custom functions that will fire and test the models
      • Searching
        • You can now do text based searches against collections, the search string is passed to the filters
      • Pills
        • For text based searches we allow for the concept of pills, e.g. user:ben status:awesome
    • Other changes:
      • New demo page allows you to modify the actual code that performs the query, instead of just the query itself
  • v0.6.0 February 11, 2012

  • v0.5.4 January 26, 2012

    • Fixed $nin
    • Added $beginsWith and $endsWith
  • v0.5.3 November 2, 2011

    • $in and $all have had considerable improvements and fixes
    • Fixed npm web to url warnings
    • Fixed demo
  • v0.5.2 September 5, 2011

    • Array prototype is no longer extended by default. Introduces queryEngine.Hash as the extender.
  • v0.5.1 August 14, 2011

    • Fixed date comparisons and added some date tests
  • v0.5.0 August 13, 2011

    • Added client side demo
    • Added queryEngine.Collection class so it doesn't extend the object prototype by default
      • If you would like to still extend the object prototype you can call queryEngine.extendNatives()
  • v0.4.0 August 13, 2011

    • Find will now return a ID associated object always
      • Before it was only doing it when the object we were finding was an ID associated object
    • Now supports $and, $or and $nor, as well as $type
  • v0.3.0 August 11, 2011

    • Now supports models as well as native javascript objects
      • This was done by checking if the record has a get function, if it does then we use that instead of directly accessing the field from the object
  • v0.2 July 6, 2011

    • Added toArray, sort, findOne, remove, forEach
  • v0.1 July 6, 2011

    • Initial commit