function
Callback with no parameter
**Kind**: global typedef **Params** - errError
## compareStrings ⇒ number
String comparison function.
if (a < b) return -1
if (a > b) return 1
return 0
**Kind**: global typedef
**Params**
- a string
- b string
## MultipleDocumentsCallback : function
Callback that returns an Array of documents
**Kind**: global typedef **Params** - errError
- docs [Array.<document>
](#document)
## SingleDocumentCallback : function
Callback that returns a single document
**Kind**: global typedef **Params** - errError
- docs [document
](#document)
## AsyncFunction ⇒ Promise.<\*>
Generic async function
**Kind**: global typedef **Params** - ...args\*
## document : Object.<string, \*>
Generic document in NeDB. It consists of an Object with anything you want inside.
**Kind**: global typedef **Properties** | Name | Type | Description | | --- | --- | --- | | [_id] |string
| Internal _id
of the document, which can be null
or undefined at some points (when not inserted yet for example).
Object.<string, \*>
Nedb query.
Each key of a query references a field name, which can use the dot-notation to reference subfields inside nested documents, arrays, arrays of subdocuments and to match a specific element of an array.
Each value of a query can be one of the following:
string
: matches all documents which have this string as value for the referenced field namenumber
: matches all documents which have this number as value for the referenced field nameRegexp
: matches all documents which have a value that matches the given Regexp
for the referenced field nameobject
: matches all documents which have this object as deep-value for the referenced field name{ field: { $op: value } }
where $op
is any comparison operator:
$lt
, $lte
: less than, less than or equal$gt
, $gte
: greater than, greater than or equal$in
: member of. value
must be an array of values$ne
, $nin
: not equal, not a member of$stat
: checks whether the document posses the property field
. value
should be true or false$regex
: checks whether a string is matched by the regular expression. Contrary to MongoDB, the use of
$options
with $regex
is not supported, because it doesn't give you more power than regex flags. Basic
queries are more readable so only use the $regex
operator when you need to use another operator with it$size
: if the referenced filed is an Array, matches on the size of the array$elemMatch
: matches if at least one array element matches the sub-query entirely$or
and $and
, the syntax is { $op: [query1, query2, ...] }
.$not
, the syntax is { $not: query }
$where
, the syntax is:{ $where: function () {
// object is 'this'
// return a boolean
} }
Object.<string, (0\|1)>
Nedb projection.
You can give find
and findOne
an optional second argument, projections
.
The syntax is the same as MongoDB: { a: 1, b: 1 }
to return only the a
and b
fields, { a: 0, b: 0 }
to omit these two fields. You cannot use both
modes at the time, except for _id
which is by default always returned and
which you can choose to omit. You can project on nested documents.
To reference subfields, you can use the dot-notation.
**Kind**: global typedef ## serializationHook ⇒string
The beforeDeserialization
and afterDeserialization
callbacks should
string
## rawIndex
**Kind**: global typedef
**Properties**
| Name | Type |
| --- | --- |
| fieldName | string
|
| [unique] | boolean
|
| [sparse] | boolean
|