Skip to content

Commit

Permalink
Detailed difference between MongoDB and ForerunnerDB query matching l…
Browse files Browse the repository at this point in the history
…ogic as described in issue #43
  • Loading branch information
Irrelon committed May 21, 2015
1 parent 106d460 commit 83eb9e1
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ a UK registered company.
## Version 1.3.35

## What is ForerunnerDB
ForerunnerDB is a NoSQL JavaScript database. It supports the same query language as
MongoDB and runs on browsers and Node.js.
ForerunnerDB is a NoSQL JavaScript database with a query language based on MongoDB
and runs on browsers and Node.js.

## What is ForerunnerDB's Primary Use Case?
ForerunnerDB was created primarily to allow web application developers to easily
Expand Down Expand Up @@ -169,9 +169,14 @@ or pass an array of documents:
}]);

## Searching the Collection
Much like MongoDB, searching for data in a collection is done using the find() method, which supports many of the same
operators starting with a $ that MongoDB supports. For instance, finding documents in the collection where the price
is greater than 90 but less than 150, would look like this:
> **PLEASE NOTE** While we have tried to remain as close to MongoDB's query language
as possible, small differences are present in the query matching logic. The main
difference is described here: [Find behaves differently from MongoDB](https://github.com/Irrelon/ForerunnerDB/issues/43)

Much like MongoDB, searching for data in a collection is done using the find() method,
which supports many of the same operators starting with a $ that MongoDB supports. For
instance, finding documents in the collection where the price is greater than 90 but
less than 150, would look like this:

itemCollection.find({
price: {
Expand Down Expand Up @@ -687,9 +692,12 @@ Result:
#### $addToSet
Adds an item into an array only if the item does not already exist in the array.

ForerunnerDB supports the $addToSet operator as detailed in the MongoDB documentation. Unlike MongoDB, ForerunnerDB also allows you to specify a matching field / path to check uniqueness against by using the $key property.
ForerunnerDB supports the $addToSet operator as detailed in the MongoDB documentation.
Unlike MongoDB, ForerunnerDB also allows you to specify a matching field / path to check
uniqueness against by using the $key property.

In the following example $addToSet is used to check uniqueness against the whole document being added:
In the following example $addToSet is used to check uniqueness against the whole document
being added:

// Create a collection document
db.collection('test').setData({
Expand Down

0 comments on commit 83eb9e1

Please sign in to comment.