new nEDMDB(url)
Extension of db.DB
Adds/updates several functions to the DB object
Parameters:
Name | Type | Description |
---|---|---|
url |
String | url to database |
- Source:
Requires:
Extends
Requires
Methods
addAttachment(doc, file_object, callback)
Add an attachment to a document
Parameters:
Name | Type | Description |
---|---|---|
doc |
Object | document from which attachment should be removed (at least { _id : "..." }) |
file_object |
Object | attachment to remove |
callback |
module:lib/update_db.DBRequestCallback |
- Source:
cancel_changes_feed(callback)
Cancel previous changes feed opened by nedm.listen_to_changes_feed
Parameters:
Name | Type | Description |
---|---|---|
callback |
module:lib/update_db.ChangesFeedCallback | gets message from EventSource object |
- Source:
(private) changes(options, callback)
Query the changes feed of a database
Parameters:
Name | Type | Description |
---|---|---|
options |
Object | request options |
callback |
module:lib/update_db.DBRequestCallback |
- Source:
db_name() → {String}
Get db name
- Source:
Returns:
name of database
- Type
- String
get_most_recent_value(var_name, callback)
Get most recent value of a particular variable
Parameters:
Name | Type | Description |
---|---|---|
var_name |
String | name of variable |
callback |
module:lib/update_db.DBRequestCallback |
- Source:
getCommands(callback)
Get all commands in a particular database
Parameters:
Name | Type | Description |
---|---|---|
callback |
module:lib/update_db.CommandsCallback |
- Source:
getList(name, list, view, other_ddocopt, qopt, callback)
get certain list function
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
name |
String | name of design document | |
list |
String | name of list function | |
view |
String | name of view function | |
other_ddoc |
String |
<optional> |
name of other design document |
q |
Object |
<optional> |
query parameters for list |
callback |
module:lib/update_db.DBRequestCallback |
- Source:
getVariableNames(callback)
Get all variable names (data) in a particular database
Parameters:
Name | Type | Description |
---|---|---|
callback |
module:lib/update_db.VariableNamesCallback |
- Source:
getView(name, view, optionsopt, callback)
Query a view
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
name |
String | name of design document | |
view |
String | name of view function | |
options |
Object |
<optional> |
query parameters for view |
callback |
module:lib/update_db.DBRequestCallback |
- Source:
getViewInfo(view, callback)
Get information from a view
Parameters:
Name | Type | Description |
---|---|---|
view |
String | name of design + view function |
callback |
module:lib/update_db.DBRequestCallback |
- Source:
getViewInfo(view, callback)
Check status of view
Parameters:
Name | Type | Description |
---|---|---|
view |
String | name of design + view function |
callback |
module:lib/update_db.ViewStatusCallback |
- Source:
guessCurrent(location)
Guess current database (most of the time this shouldn't be used)
Parameters:
Name | Type | Description |
---|---|---|
location |
Object | URL |
- Source:
listen_to_changes_feed(callback)
Listen to changes feed of a particular database. If feed is already open,
then add a listener to that feed. *This should be used sparingly!* Chances
are, the same functionality can be gained by listening to aggregate changes:
Parameters:
Name | Type | Description |
---|---|---|
callback |
module:lib/update_db.ChangesFeedCallback | gets message from EventSource object |
- Source:
- See:
-
- lib/nedm.on_db_updates
off(typeopt)
cancel callback for changes in the database
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
type |
string |
<optional> |
type of changes, "data", |
- Source:
on(typeopt, callback)
register for changes in the database
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
type |
string |
<optional> |
"both" | type of changes, "data", "heartbeat", "both" or "latest" |
callback |
module:lib/update_db.OnChangesCallback | module:lib/update_db.OnLatestCallback | when type = "latest", uses OnLatestCallback |
- Source:
removeAttachment(doc, file_name, callback)
Remove an attachment from a document
Parameters:
Name | Type | Description |
---|---|---|
doc |
Object | document from which attachment should be removed (at least { _id : "..." }) |
file_name |
String | attachment to remove |
callback |
module:lib/update_db.DBRequestCallback |
- Source:
request(req, callback)
handle requests, enables dealing with progress functions
Parameters:
Name | Type | Description |
---|---|---|
req |
Object | request |
callback |
module:lib/update_db.DBRequestCallback |
- Source:
send_command(o) → {module:lib/update_db.CommandReturnObject}
Send command
Parameters:
Name | Type | Description |
---|---|---|
o |
module:lib/update_db.CommandObject | information for command |
- Source:
Returns:
updateDoc(doc, designname, updatename, callback)
Call update function on design document
Parameters:
Name | Type | Description |
---|---|---|
doc |
Object | document to insert |
designname |
String | name of design document |
updatename |
String | name of update function |
callback |
module:lib/update_db.DBRequestCallback |
- Source: