$ update operator, 253
a directive (AngularJS templates), 450
abort() method, 165
acceptsCharset() method, 365
access control, MongoDB, configuring, 216-218
user accounts
MongoDB
assigning database roles to, 214
configuring access control, 216-218
removing, 215
$add aggregation expression operator, 292
$addToSet aggregation expression operator, 292
$addToSet update operator, 253
address schema, shopping cart, defining, 546-547
addToCart() function, 572
addUser() method, 213, 235, 237
admin() method, 235
Admin object (MongoDB driver), 237
MongoDB user accounts, 212-215
agent option (ClientRequest object), 123
aggregate() method, 289-290, 306, 325
aggregation
documents, Mongoose, 325
MongoDB query results, 289-293
aggregation operators, 290
all() method, 309
allowHalfOpen option
net.Server objects, 148
Socket object, 145
and() method, 309
AngularJS, 4, 14, 397-398, 409
animations, 484
applications
defining root element, 407
browser alerts, implementing, 478
browser cookies, interacting with, 478-479
controllers, 400
data models, 399
dependency injection, 400, 411-412, 418
adding controllers to, 466-467
animation, 481
binding model to page elements, 453-454
binding page elements to controllers, 453-459
creating custom, 467
creating to extend HTML, 461-467
form element extensions, 450-452
functionality support, 448
expressions, 399
filters
global APIs, 404
HTML documents, bootstrapping in, 189
HTTP Get and Put requests, sending, 473-475
JavaScript, integration, 402-403
bootstrap phase, 401
compilation phase, 402
runtime data binding phase, 188
link() function, manipulating DOM, 465-466
loading library, 407
modules, 398-399, 411-412, 418
creating Module object, 413
implementing to support comment views, 534-540
run blocks, 414
using HTML code to implement, 417
Node.js, adding to environment, 403
page controllers, implementing, 537-538
emitting and broadcasting events, 428-429
expressions, 436
filters, 440
implementing hierarchy, 425-426
relationship between backend server data, 423-424
relationship between controllers, 420-421
relationship between root scope and applications, 419-420
relationship between templates, 421-422
sorting and ordering, 442
separation of responsibilities, 401
$interval, 481
$timeout, 481
$window, 478
creating constant services, 487
creating factory services, 487-488
creating service services, 488
creating value services, 487
integrating in modules, 488-489
shopping cart, view support, 570-579
table controller, defining, 601-603
tables view, 603
adding controllers to, 407
creating custom filters, 443-444
defining directive view, 462
modifying data displayed in rendered view, 440
obtaining data from scope model, 436
replacing elements, 463
transcluding external scopes, 463-464
timers, implementing, 481
views, 447
creating with templates, 433-445
weather controller, defining, 594
weather view
defining, 595
angular.module() method, 413
$animate built-in service (AngularJS), 472, 481-484
animations
elements, AngularJS, 484
implementing in CSS, AngularJS, 481
anonymous functions, 26
APIs, global, AngularJS, 404
append() method, 323
application servers, creating, 586-587
applications
creating basic, AngularJS, 405-409
RIAs (rich Internet applications), 583
app.render() method, 378
arch() method, 185
arch property (process module), 165
argv property (process module), 165
arithmetic operators, JavaScript, 17-18
combining, 34
items
adding/removing, 35
checking for, 35
JavaScript, 16
strings
converting into, 35
splitting into, 32
assignment operators, JavaScript, 18
asynchronous callback, creating a wrapper function, 70
asynchronous calls, file system, 97-98
asynchronous file reads, 108
asynchronous file writing, 102-103
atomic write operations, MongoDB, 202
atomically modifying documents in collections, 260-261
attachment() method, 367
auth option (ClientRequest object), 123
authenticate() method, 235, 237
authentication
authenticate() method, 235, 237
MongoDB, 217
author directive (package.json file), 46
auto_reconnect option (Server object), 229
autoIndex option (Schema object), 300
autoIndexID role (MongoDB), 221
backend server data, AngularJS scopes, relation between, 423-424
backend weather service, Node.js server, creating on, 592-593
base64() method, 75
basic-auth-connect middleware (Express), 390-391
billing, shopping cart, verifying, 575
billing schema, shopping cart, defining, 547
billing view, shopping cart, implementing, 563
bin directive (package.json file), 46
$bit update operator, 253
blocking Node.js I/O, 57
blocks, try/catch, 36
Booleans, JavaScript, 16
bootstrap phase, AngularJS life cycle, 401
bootstrapping AngularJS in HTML documents, 189
broadcasting events, AngularJS scopes, 428-429
browsers
alerts, implementing, 478
browser-to-webserver communication, 8-9
cookies, interacting with, 478-479
user interaction, 10
bufferCommands option (Schema object), 300
buffering data, Buffer module, 74-82
bufferMaxEntries option (MongoClient connections), 230
buffers
concatenating, 82
creating, 76
determining length, 79
slicing, 81
bufferSize property (Socket objects), 147
built-in directives, AngularJS templates, 447-459
built-in filters, AngularJS templates, 438
built-in services, AngularJS, 472-484
bytesRead property (Socket objects), 147
bytesWritten property (Socket objects), 147
ca option
https.request method, 140
tls.connect() method, 158
tls.createServer() method, 159
cache property (config parameter), 473
$cacheFactory built-in service (AngularJS), 472, 477-478
callback parameter, group() method, 287
callbacks
asynchronous, creating a wrapper function, 70
closure, implementing in, 69
events, 56
passing additional parameters to, 68
capped collections (MongoDB), 202, 336
capped option (Schema object), 300
capped role (MongoDB), 221
cart. See shopping cart
cart view, shopping cart, implementing, 560. See also shopping cart
case sensitive routing setting (Express), 357
cert option
https.request method, 140
tls.connect() method, 158
tls.createServer() method, 159
chaining callbacks, 70-71, 113
chdir() method, 165
checkKeys option (database changes), 251
checkout() function, 574
child forks, implementing, 175-176
chunkCollection() method, 350
ciphers option (https.request method), 140
ciphers option (tls.createServer() method), 159
Client object, MongoDB, connecting to via, 230-231
clientError event (TLS Server objects), 159
clients
HTTP, requests to test servers, 182
HTTPS (Hypertext Transfer Protocol Secure), implementing, 139-140
TCP socket, implementing, 151-152
TLS (Transport Layer Security), implementing, 157-158
client-side scripts, 9
close event
ChildProcess object, 168
net.Socket object, 149
Socket objects, 145
close() method, 149, 235, 240, 350
closure, callbacks, implementing in, 69
clusterAdmin database role (MongoDB), 214
clusters
HTTP, implementing, 181
process, implementing, 178-181
Collection object, MongoDB driver, 238
collection option (Schema object), 300
collectionInfo() method, 235
collectionNames() method, 235
collections (MongoDB), 196
aggregating query results, 289-293
displaying in databases, 220-221
documents
atomically modifying in, 260-261
counting specific sets of in collections, 277-278
finding distinct field values in a specific set of, 286
grouping sets of documents by specific fields in, 288, 294
limiting specific sets of, 279
paging results, 282
saving in, 262
field values, finding, 285
fields
forcing required, 302
implementing unique, 302
indexing, 203
obtaining information, 248
replications, 203
enabling on, 347
shared tag ranges, setting up, 347
statistics, retrieving and displaying, 248
word_stats, implementing schema, 303
collections() method, 235
command parameter, group() method, 287
command services, creating, 534-535
commands
spawning in another process, 174-175
comment() method, 307
comment option (options object), 272
comment thread view, implementing, 530-531
comment threads, webpages, adding to, 515-541
comment view, implementing, 532
comments
adding to servers, 535
comment application server routes for Express, 521
partial comment template, 531-532
photo comments portion of view, 537-538
retrieving from servers, 535
server, creating, 520
CommentThread model (Mongoose)
implementing controller, 523-526
comparison operators, JavaScript, 19-21
$compile built-in service (AngularJS), 472
compilation phase, AngularJS life cycle, 402
compiling Mongoose models, 304
compound index (MongoDB), 334
compression, Zlib module, 93-95
$concat aggregation expression operator, 292
concatenating buffers, 82
conditional operators, JavaScript, 20
config property (process module), 165
config server database instances, creating, 345
configuration
Express, 357
MongoDB access control, 216-218
configuration blocks, AngularJS modules, 413-414
connect event (Socket objects), 145
connect option (ClientRequest object), 124
connected property (ChildProcess object), 169
connection event (net.Socket object), 149
connection strings, MongoDB, connecting to, 232-234
console module (Node.js), writing data to, 52
constant() method, 415
constant services (AngularJS), creating, 487
continue option (ClientRequest object), 124
contributors directive (package.json file), 46
controller property (AngularJS templates), 461
controllers
AngularJS, 400
adding to templates, 407
binding page elements to, 453-459
directives, adding to, 466-467
scopes, relationship between, 420-421
shopping cart
product model, 552
weather, defining, 594
cookie-parser middleware (Express), 387-388
cookies
Express, sending and receiving, 387-388
interacting with, AngularJS, 478-479
$cookies built-in service (AngularJS), 472
cookie-session middleware (Express), 388-389
$cookieStore service (AngularJS), 478-479
copy() method, 404
copying
MongoDB databases, 220
counting MongoDB documents, 276-277
cpus() method, 185
create() method, 306
createCollection() method, 235, 336
creation phase (AngularJS scope), 424
https.createServer() method, 140
tls.createServer() method, 159
CSS (cascading style sheets)
adding to style views, 507
files, 9
currency[:symbol] filter (AngularJS templates), 438
Cursor object, MongoDB driver, 240
custom defined objects, creating, 28-29
custom directives, AngularJS, 590-591
creating, 467
custom Express middleware, creating, 395
custom filters, AngularJS, creating, 444-445
custom services, AngularJS, creating, 487-489
customer model controllers, shopping cart, implementing, 554-555
customer schema, shopping cart, defining, 549-550
cwd() method, 165
cwd option
exec() function, 170
fork() function, 175
spawn() function, 173
data
buffering, Buffer module, 74-82
data binding, AngularJS, 14, 400
data event (Socket objects), 145
data life cycles, MongoDB, 204
data models
AngularJS, 399
data normalization, MongoDB, 199-200
data property (config parameter), 473
data types
MongoDB, 198
data usability, MongoDB, 204
databases (MongoDB). See also collections
administering, 212-215, 218-220
change options, 251
configuring access control, 216-218
connecting to via Client object, 231-232
copying, 220
displaying collections in, 220-221
enabling sharding on, 346
date[:format] filter (AngularJS templates), 438
db() method, 235
Db object (MongoDB driver), 235
dbAdmin database role (MongoDB), 214
dbAdminAnyDatabase database role (MongoDB), 214
decompression, Zlib module, 93-95
defining
address schema, shopping cart, 546-547
billing schema, shopping cart, 547
customer schema, shopping cart, 549-550
Express template engine, 375
order schema, shopping cart, 548-549
Page model, 517
Photo model, 518
product schema, shopping cart, 547-548
quantity schema, shopping cart, 548
weather controller, 594
weather view, 595
deleteFromCart() function, 573-574
deleteUser route, implementing, 499
deleting files, 114
denormailizing data, MongoDB, 200-201
dependencies directive (package.json file), 46
dependency injection, AngularJS, 400, 411-412, 418
deployment, sharded MongoDB clusters, 344-347
dereferencing timers, 63
description directive (package.json file), 46
detached option, spawn() function, 173
directives (AngularJS), 399, 469
adding controllers to, 466-467
creating custom, 467
binding model to page elements, 453-454
binding page elements to controllers, 453-459
creating to extend HTML, 461-467
form element extensions, 450-452
functionality support, 448
directories
creating and removing, 115-116
renaming, 116
disconnect event
ChildProcess object, 168
cluster module, 178
Worker object, 180
disconnect() method, 169, 179-180, 299
distinct() method, 238, 285, 306
$divide aggregation expression operator, 292
$document built-in service (AngularJS), 472
documents
HTML, bootstrapping AngularJS in, 189
MongoDB, 196-198. See also collections (MongoDB)
adding to collections, 223, 254-255
adding via Mongoose, 314
aggregating via Mongoose, 323-325
atomically modifying in collections, 260-261
counting specific sets of in collections, 277-278
deleting from collections, 224, 265
finding distinct field values in a specific set of, 286
finding in collections, 222
finding specific sets of, 273-274
finding via Mongoose, 312
grouping sets of by specific fields in collections, 288, 294
growth, 203
inserting in collections, 263
limiting fields returned by, 280
obtaining from collections, 256-257
removing single from collection, 266-267
removing via Mongoose, 320-322
saving in collections, 262
updating in collections, 224-225, 258-259
updating via Mongoose, 316-319
domains, performing lookups and reverse lookups, 193
do/while loops, 22
download responses, sending, 373
draggable views, 607
drain event (Socket objects), 145
drop() method, 238
dropCollection() method, 235
dropDatabase() method, 235
dynamic GET servers, implementing, 132-133
each() method, 240
$each update operator, 253
element() method, 404
elemMatch() method, 309
emitting events, AngularJS scopes, 428-429
encoding option
exec() function, 170
fork() function, 175
end event (Socket objects), 145
end() method, 146
endian, 75
endianness() method, 185
engines directive (package.json file), 46
env option
exec() function, 170
fork() function, 175
spawn() function, 173
env property (process module), 165
env setting (Express), 357
environments, MongoDB, building, 207-212
eof() method, 350
error event
ChildProcess object, 168
net.Socket object, 149
Socket objects, 145
Worker object, 180
error handling, JavaScript, adding, 36-38
errors method, 310
event queue, Node.js, adding work to, 59-66
EventEmitter object, creating custom, 66-67
AngularJS scopes, emitting and broadcasting, 428-429
callbacks, 56
ChildProcess object, 168
cluster module, 178
creating anonymous function for additional parameters, 68-69
EventEmitter object, creating custom, 66-67
Node.js
processes, 164
Socket objects, 145
net.Socket, 149
Worker object, 180
exec() function, processes, executing system commands on, 170
exec() method, 323
execArgv property (process module), 165
execFile() function, 170
processes, executing executable files on another, 171-172
execPath option (fork() function), 175
execPath property (process module), 165
executable files, executing on another process, 171-172
executables, Node.js, verifying, 41
exists() method, 309
exit event
ChildProcess object, 168
cluster module, 178
Worker object, 180
exit() method, 165
explain option (options object), 272
HTTP, 391
configuring, 357
cookies, sending and receiving, 387-388
HTTP authentication, applying, 390-391
adding multiple functions, 383
assigning globally to paths, 382-383
assigning to a single route, 383
creating custom, 395
POST parameters, 386
static, 384
Request object, 365
accessing properties, 365
redirecting, 374
redirecting responses, 373-374
sending download responses, 373
sending JSON responses, 369-370
sending responses, 368
route controller, creating for/words route, 600-601
routes
applying parameters in, 361-363
implementing HTTP and HTTPS, 359
implementing user controller routes, 496-501
sessions
template engines
defining, 375
templates
rendering in responses, 378
webservers, implementing application database connection, 494
Express module, Node.js-to-AngularJS stack, 13
expressions, AngularJS, 399
extend() method, 404
factory() method, 415
factory services (AngularJS), creating, 487-488
field values, MongoDB, finding, 285
fields, collections (MongoDB)
forcing required, 302
implementing unique, 302
fields option (options object), 272
file system
directories, creating and removing, 115-116
files
allowing streaming writes to, 104
asynchronous reads, performing, 108
asynchronous writes, performing to, 103
CSS (cascading style sheets), 9
deleting, 114
executable, executing on another process, 171-172
HTML, 9
information, obtaining, 111-112
JSON (JavaScript Object Notation) strings, writing to, 100
listing, 113
media, 9
monitoring changes, 117
renaming, 116
sending, Response object, 371-372
serving static, Express, 384
streaming reads, 110
synchronous reads, performing, 107
synchronous writes, performing to, 101-102
verifying path existence, 110-111
filter:exp:compare filter (AngularJS templates), 438
filters, AngularJS
scopes, 440
creating custom filters, 443-444
implementing ordering and filtering, 441
finalize parameter, group() method, 287
finally keyword, error handling, 36
find() method, 238, 256, 278-279, 306
findAndModify() method, 238, 260-261
findAndRemove() method, 238, 267
findOne() method, 238, 256, 306
findOneAndRemove() method, 306
findOneAndUpdate() method, 306
$first aggregation expression operator, 292
forceServerObjectId option (database changes), 251
forEach() method, 404
for/in loops, 23
fork event (cluster module), 178
form parameters, processing, 121-122
form/ngform directive (AngularJS templates), 450
forms, element extension, AngularJS directives, 450-452
freemen() method, 185
fresh property (Request object), 365
fromJson() method, 404
fs.stats() method, 112
fsync option
database changes, 251
MongoClient connections, 230
functionality
AngularJS templates, directives, 448
objects, inheriting from other, 190
functions, 24. See also methods
addToCart(), 572
anonymous, 26
checkout(), 574
console module (Node.js), 52
exec(), 170
Express middleware, adding, 383
hashPW(), 496
passing variables to, 25
verifyBilling(), 575
geospatial index (MongoDB), 334
get() method, 310, 349, 365, 367
Get requests, sending, AngularJS, 473-475
GET servers, implementing dynamic, 132-133
getc() method, 350
getConnections() method, 149
getgid() method, 165
getSortObj() function, 600-601
getuid() method, 165
getUserProfile routes, implementing, 498
gid option, spawn() function, 173
global APIs, AngularJS, 404
global variables, defining, 27
globally assigning Express middleware to paths, 382-383
Google, authentication, Passport NPM, 511-512
Grid object, 349
GridFS (MongoDB)
Grid object, implementing from Node.js, 348-349
GridStore object, implementing from Node.js, 350-352
$group operator, aggregation() method, 290
gt() method, 309
gte() method, 309
handshakeTimeout option, tls.createServer() method, 159
hash-based sharding, MongoDB, 344
hashed index (MongoDB), 334
hashPW() function, 496
headers
HTTP, 10
Response object, setting, 366-367
headers option (ClientRequest object), 123
headers property
config parameter, 473
Request object, 365
helper functions, shopping cart, 572
Hex() method, 75
hierarchy, AngularJS scope, implementing, 425-426
hint() method, 307
hint option (options object), 272
honorCipherOrder option, tls.createServer() method, 159
host option
ClientRequest object, 123
Socket object, 145
host property (Request object), 365
hostname() method, 185
hostname option (ClientRequest object), 123
hrtime() method, 165
HTML documents, 9
AngularJS, bootstrapping in, 189
$http built-in service (AngularJS), 472-475
HTTP (HyperText Transfer Protocol)
authentication, applying, Express, 390-391
clusters, implementing, 181
headers, 10
service URLs (uniform resource locators), processing, 119-121
http.ClientRequest object, 122-124
http.IncomingMessage object, 126
httpOnly property (options parameter), 387
HTTPS (Hypertext Transfer Protocol Secure)
clients, implementing, 139-140
servers, implementing, 139-140, 142
https.createServer() method, 140
http.ServerResponse object, 125
https.request() method, 140
_id index (MongoDB), 334
_id option (Schema object), 300
id() method, 310
id option (Schema object), 300
id property (Worker object), 180
if statements, 20
in() method, 309
$inc update operator, 253
view, implementing, 503
indexing, MongoDB collections, 203
inheritance, functionality, from other objects, 190
initgroups() method, 165
initial parameter, group() method, 287
initializing shopping cart, 579-581
input directive (AngularJS templates), 450
input.checkbox directive (AngularJS templates), 450
input.email directive (AngularJS templates), 450
input.number directive (AngularJS templates), 450
input.radio directive (AngularJS templates), 450
input.text directive (AngularJS templates), 450
input.url directive (AngularJS templates), 450
installation
NPMs (Node Packaged Modules), 44-45
$interval built-in service (AngularJS), 472, 481
interval timers, 61
invalidate() method, 310
I/O (input/output), Node.js, blocking, 57
IP addresses, performing lookups and reverse lookups, 193
ip property (Request object), 365
IPC (interprocess communication), 143
isArray() method, 404
isClosed() method, 240
isDate() method, 404
isDefined() method, 404
isElement() method, 404
isFunction() method, 404
isInit() method, 310
isMaster property (cluster module), 179
isModified() method, 310
isNew() method, 310
isNumber() method, 404
isObject() method, 404
isSelected() method, 310
isString() method, 404
isUndefined() method, 404
isWorker property (cluster module), 179
iterating through arrays, 34-35
AngularJS, integration, 402-403
adding/removing items, 35
checking item contents, 35
combining, 34
converting into strings, 35
Booleans, 16
functions, 24
anonymous, 26
passing variables to, 25
if statements, 20
JSON (JavaScript Object Notation), converting to objects, 74
loops, 21
for/in, 23
do/while, 22
null, 17
numbers, 16
object literal, 17
objects, 27
converting to JSON, 74
creating custom defined, 28-29
assignment, 18
conditional, 20
strings, 16
replacing a word in, 32
splitting into an array, 32
variables
journal option
database changes, 251
MongoClient connections, 230
jQuery, AngularJS, integration, 402-403
JSON (JavaScript Object Notation), 73-74
converting JavaScript objects to, 74
converting to JavaScript objects, 74
reading string files to objects, 106
json filter (AngularJS templates), 438
json replacer setting (Express), 357
json spaces setting (Express), 357
jsonp callback name setting (Express), 357
key option
https.request method, 140
tls.connect() method, 158
tls.createServer() method, 159
keys parameter, group() method, 287
keywords directive (package.json file), 46
killSignal option (exec() function), 170
$last aggregation expression operator, 292
length, buffers, determining, 79
life cycles, AngularJS scopes, 401-402, 424-425
bootstrap phase, 401
compilation phase, 402
runtime data binding phase, 188
$limit operator, aggregation() method, 290
limit option (options object), 272
limitTo:limit filter (AngularJS templates), 438
link() function, manipulating DOM, 465-466
link property (AngularJS templates), 461
listDatabases() method, 237
listen() method, 149
cluster module, 178
net.Socket object, 149
listing files, 113
listing users, MongoDB, 212-213
loadavg() method, 185
local variables, defining, 27
localAddress option
ClientRequest object, 123
Socket object, 145
localAddress property (Socket objects), 147
$locale built-in service (AngularJS), 472
localPort property (Socket objects), 147
locals, Express template engine, adding, 375-376
$location built-in service (AngularJS), 472
location() method, 367
login routes, implementing, 497
login view, implementing, 504
lookup() method, 191
loops, JavaScript, 21
for/in, 23
do/while, 22
lowercase filter (AngularJS templates), 438
lowercase() method, 404
lt() method, 309
lte() method, 309
main directive (package.json file), 46
makePurchase() function, 575-576
MapReduce, aggregating results, 289-293
markModified() method, 310
match() method, 323
$match operator, aggregation() method, 290
$max aggregation expression operator, 292
max role (MongoDB), 221
maxAge property (options parameter), 387
maxBuffer option, exec() function, 170
maxScan option (options object), 272
maxTickDepth property (process module), 165
media files, 9
memoryUsage() method, 165
message event
ChildProcess object, 168
Worker object, 180
method option (ClientRequest object), 123
method property
config parameter, 473
Request object, 365
in(), 309
or(), 309
and(), 309
abort(), 165
acceptsCharset(), 365
admin(), 235
aggregate(), 289-290, 306, 325
all(), 309
angular.module(), 413
append(), 323
app.render(), 378
arch(), 185
attachment(), 367
chdir(), 165
ChildProcess objects, 169
chunkCollection(), 350
cluster module, 179
collectionInfo(), 235
collectionNames(), 235
collections(), 235
comment(), 307
constant(), 415
copy(), 404
cpus(), 185
create(), 306
cwd(), 165
db(), 235
disconnect(), 169, 179-180, 299
drop(), 238
dropCollection(), 235
dropDatabase(), 235
each(), 240
element(), 404
elemMatch(), 309
encoding between strings and binary buffers, 75
end(), 146
endianness(), 185
eof(), 350
errors, 310
exec(), 323
exists(), 309
exit(), 165
extend(), 404
factory(), 415
find(), 238, 256, 278-279, 306
findAndModify(), 238
findOneAndRemove(), 306
findOneAndUpdate(), 306
forEach(), 404
freemen(), 185
fromJson(), 404
fs.stats(), 112
getc(), 350
getConnections(), 149
getgid(), 165
getuid(), 165
gt(), 309
gte(), 309
hint(), 307
hostname(), 185
hrtime(), 165
id(), 310
initgroups(), 165
invalidate(), 310
isArray(), 404
isClosed(), 240
isDate(), 404
isDefined(), 404
isElement(), 404
isFunction(), 404
isInit(), 310
isModified(), 310
isNew(), 310
isNumber(), 404
isObject(), 404
isSelected(), 310
isString(), 404
isUndefined(), 404
listDatabases(), 237
listen(), 149
loadavg(), 185
location(), 367
logout(), 237
logout() method, 235
lookup(), 191
lowercase(), 404
lt(), 309
lte(), 309
manipulating string objects, 30
markModified(), 310
match(), 323
memoryUsage(), 165
mod(), 309
model(), 304
modifiedPaths(), 310
ne(), 309
net.Server object, 149
networkInterfaces(), 185
nextObject(), 240
nin(), 309
nor(), 309
os module, 185
platform(), 185
passport.authenticate(), 510
pause(), 146
ping(), 237
process execution, 165
project(), 323
provider(), 416
put(), 348
puts(), 350
queryRemover(), 395
readlines(), 350
regex(), 309
release(), 185
remove(), 238, 306, 310, 320-322, 499
rename(), 238
renameCollection(), 235
req.logout(), 511
resolve(), 191
resume(), 146
reverse(), 191
safe(), 307
save(), 238, 262, 310, 392, 498
schema, 310
Schema object, adding to, 302-303
seek(), 350
select(), 307
serializeUser(), 510
service(), 415
setEncoding(), 146
setgid(), 165
setgroups(), 165
setKeepAlive(), 146
setNoDelay(), 146
setOptions(), 307
setTimeout(), 146
setuid(), 165
setupMaster(), 179
size(), 309
snapshot(), 307
stream(), 350
tell(), 350
tls.connect(), 158
tls.createServer(), 159
tmpdir(), 185
toArray(), 240
toJSON(), 310
toJson(), 404
toObject(), 310
toString(), 310
totalmen(), 185
touch(), 392
unlink(), 350
unwind(), 323
uppercase(), 404
validate(), 310
value(), 415
where(), 309
writeFile(), 350
middleware, Express, 381-382, 396
adding multiple functions, 383
assigning globally to paths, 382-383
assigning to a single route, 383
creating custom, 395
POST parameters, 386
static, 384
middleware framework, Mongoose, 328-329
$min aggregation expression operator, 292
$mod aggregation expression operator, 292
mod() method, 309
model() method, 304
model mutation phase (AngularJS scope), 425
model-based controller routes
models, Mongoose, compiling, 304
modifiedPaths() method, 310
Module object, creating, 413
modules, 185
AngularJS, 398-399, 411-412, 418
creating Module object, 413
implementing to support comment views, 534-540
run blocks, 414
console, writing data to, 52
NPMs (Node Packaged Modules), 42-47, 491, 508-512
parameters, 208
MongoDB, 3-4, 12-13, 195-196, 207, 226, 227, 295, 355
accessing from shell client, 209-212
atomic write operations, 202
authentication, 217
Client object, connecting to via, 230-231
collections, 196
adding documents to, 223, 254-255
atomically modifying documents in, 260-261
counting specific sets of documents in, 277-278
deleting documents from, 224, 265
displaying in databases, 220-221
finding documents in, 222, 257, 274-275
forcing required fields, 302
grouping sets of documents by specific fields in, 288, 294
implementing unique fields, 302
indexing, 203
inserting documents into, 255, 263
limiting specific sets of documents, 279
obtaining documents from, 256-257
obtaining information, 248
paging results, 282
removing single document from, 266-267
replications, 203
retrieving and displaying stats, 248
saving documents in, 262
updating documents in, 224-225, 258-259
word_stats, 303
commands, parameters and results, 211
connecting to
MongoClient object instance, 231-232
data life cycles, 204
data types, 198
data usability, 204
databases
change options, 251
copying, 220
displaying collections in, 220-221
adding to collections, 223, 254-255
adding via Mongoose, 314
aggregating via Mongoose, 323-325
atomically modifying in collections, 260-261
deleting from collections, 224, 265
finding distinct field values in a specific set of, 286
finding in collections, 222
finding specific sets of, 273-274
finding via Mongoose, 312
growth, 203
inserting in collections, 263
limiting fields returned by, 280
obtaining from collections, 256-257
removing single from collection, 266-267
removing via Mongoose, 320-322
saving in collections, 262
updating in collections, 224-225, 258-259
updating via Mongoose, 316-319
field values, finding, 285
GridFS
implementing Grid object from Node.js, 348-349
implementing GridStore object from Node.js, 350-352
methods, 211
Node.js
options, 272
query results
sorting sets, 283
scripting shell, 212
server, obtaining status, 244
Server object, 229
shared keys, choosing, 341
shell commands, 210
starting, 208
stopping, 209
user accounts
assigning database roles to, 214
configuring access control, 216-218
creating database administrator accounts, 217-218
creating user administrator accounts, 216
removing, 215
write concern levels, 228
MongoDB Node.js driver, 249, 267, 269, 295. See also MongoDB
adding documents to collections, 254-255
aggregating query results, 289-293
atomically modifying documents in collections, 260-261
databases
change options, 251
deleting documents from collections, 265
finding field values, 285
finding specific sets of documents, 273-274
inserting documents in collections, 263
obtaining documents from collections, 256-257
obtaining server status, 243
query options objects, 272
removing a single document from a collection, 266-267
sorting result sets, 283
updating documents in collections, 258-259
CommentThread model, defining, 518-519
Document object, 310
documents
adding, 314
finding, 312
models, compiling, 304
MongoDB databases, connecting to, 298-299
objects, 298
Page model, defining, 517
paths, 300
Photo model, defining, 518
setting query database operation, 306
setting query operators, 308-309
multi option (database changes), 251
multikey index (MongoDB), 334
multiple documents, updating, via Mongoose, 316-319
$multiply aggregation expression operator, 292
mutation observation phase (AngularJS scope), 425
name directive (package.json file), 46
ne() method, 309
networkInterfaces() method, 185
new option (database changes), 251
newSession event (TLS Server objects), 159
nextObject() method, 240
nextTick() method, 165
ngApp directive (AngularJS templates), 448
ngBind directive (AngularJS templates), 453
ngBindHtml directive (AngularJS templates), 453
ngBindTemplate directive (AngularJS templates), 453
ngBlur directive (AngularJS templates), 458
ngChange directive (AngularJS templates), 458
ngChecked directive (AngularJS templates), 458
ngClass directive (AngularJS templates), 453, 481
ngClassEvent directive (AngularJS templates), 453
ngClassOdd directive (AngularJS templates), 453
ngClick directive (AngularJS templates), 458
ngCloak directive (AngularJS templates), 448
ngController directive (AngularJS templates), 448
ngCopy directive (AngularJS templates), 458
ngCut directive (AngularJS templates), 458
ngDblClick directive (AngularJS templates), 458
ngDisabled directive (AngularJS templates), 453
ngFocus directive (AngularJS templates), 458
ngHide directive (AngularJS templates), 453, 481
ngHref directive (AngularJS templates), 448
ngIf directive (AngularJS templates), 453, 481
ngInclude directive (AngularJS templates), 448, 481
ngInit directive (AngularJS templates), 453
ngKeydown directive (AngularJS templates), 458
ngKeypress directive (AngularJS templates), 458
ngKeyup directive (AngularJS templates), 458
ngList directive (AngularJS templates), 448
ngModel directive (AngularJS templates), 453
ngMousedown directive (AngularJS templates), 458
ngMouseenter directive (AngularJS templates), 458
ngMouseleave directive (AngularJS templates), 458
ngMousemove directive (AngularJS templates), 458
ngMouseover directive (AngularJS templates), 458
ngMouseup directive (AngularJS templates), 458
ngNonBindable directive (AngularJS templates), 448
ngOpen directive (AngularJS templates), 448
ngOptions directive (AngularJS templates), 450
ngPaste directive (AngularJS templates), 458
ngPluralize directive (AngularJS templates), 448
ngReadonly directive (AngularJS templates), 448
ngRepeat directive (AngularJS templates), 453, 481
ngRequired directive (AngularJS templates), 448
ngSelected directive (AngularJS templates), 448
ngShow directive (AngularJS templates), 453, 481
ngSrc directive (AngularJS templates), 448
ngSrcset directive (AngularJS templates), 448
ngStyle directive (AngularJS templates), 453
ngSubmit directive (AngularJS templates), 458
ngSwipeLeft directive (AngularJS templates), 458
ngSwipeRight directive (AngularJS templates), 458
ngSwitch directive (AngularJS templates), 453, 481
ngTransclude directive (AngularJS templates), 448
ngValue directive (AngularJS templates), 453
ngView directive (AngularJS templates), 448, 481
nin() method, 309
Node Package Registry, 42
Node.js, 2-3, 12, 39-40, 53-55, 72-73, 96-97, 117, 183-184, 193
AngularJS, adding to environment, 403
benefits, 3
buffering data, Buffer module, 74-82
callbacks, implementing, 68-71
clusters, HTTP, 181
event queue, adding work to, 59-66
events
callbacks, 56
Express, 357
configuring, 357
implementing template engines, 374-378
Request object, 365
file paths, verifying existence, 110-111
file system
creating and removing directories, 115-116
renaming directories, 116
files
deleting, 114
listing, 113
monitoring changes, 117
obtaining information, 111-112
renaming, 116
http.ClientRequest object, 122-124
http.IncomingMessage object, 126
http.ServerResponse object, 125
implementing clients and servers, 130-137
implementing HTTPS servers and clients, 139-142
processing query strings and form parameters, 121-122
processing URLs (uniform resource locators), 119-121
IDEs, selecting, 41
I/O (input/output), blocking, 57
JSON (JavaScript Object Notation), 73-74
console, writing data to, 52
NPMs (Node Packaged Modules), 42-47, 491, 508-512
MongoDB
implementing Grid object from, 348-349
implementing GridStore object from, 350-352
obtaining collection information, 248
saving documents in collections, 262
write concern levels, 228
MongoDB driver, 249, 267, 269, 295
adding documents to collections, 254-255
aggregating query results, 289-293
atomically modifying documents in collections, 260-261
database change options, 251
database update operators, 252-253
deleting documents from collections, 265
finding field values, 285
finding specific sets of documents, 273-274
inserting documents in collections, 263
obtaining documents from collections, 256-257
obtaining server status, 243
query options objects, 272
removing a single document from a collection, 266-267
sorting result sets, 283
updating documents in collections, 258-259
compiling models, 304
connecting to MongoDB databases, 298-299
Document object, 310
objects, 298
NPMs (Node Packaged Modules), 42-47 491
installing NPMs (Node Packaged Modules), 44-45
searching for, 44
packages, 42
installing NPMs (Node Packaged Modules), 44-45
Node Package Registry, 42
NPM (Node Package Manager), 43
NPMs (Node Packaged Modules), 42
process clusters, implementing, 178-181
scaling applications, 163
implementing TCP socket clients, 151-152
implementing TCP socket servers, 154-155
implementing TLS clients, 157-158
implementing TLS servers, 159
verifying executables, 41
Node.js-to-AngularJS stack, 7, 11, 14
AngularJS, 14
Express module, 13
Node.js, 12
nor() method, 309
collections, 196
data types, 198
NPM (Node Package Manager), 43
NPMs (Node Packaged Modules), 42-47, 491
installing NPMs (Node Packaged Modules), 44-45
searching for, 44
NPNProtocols option, tls.createServer() method, 159
number[:fraction] filter (AngularJS templates), 438
numberOfRetries option (MongoClient connections), 230
numberOfRetries option (options object), 272
numbers, JavaScript, 16
object literal, JavaScript, 17
objects, 27
Buffer
concatenating, 82
copying data from one another, 80
creating and manipulating slices, 81
reading from, 78
writing to, 77
checking types, 188
Client, connecting to MongoDB via, 230-231
creating custom defined, 28-29
Document, 310
EventEmitter, creating custom, 66-67
GridStore object, implementing from Node.js, 350-352
inheriting functionality from other, 190
JavaScript
converting JSON to, 74
converting to JSON, 74
converting to strings, 189
JSON string files, reading to, 106
limiting fields returned in, 280
Model, 304
Module, creating, 413
Admin object, 237
Collection object, 238
Cursor object, 240
Db object, 235
Mongoose, 298
options, 272
Request, 365
Server, MongoDB, 229
Socket
events, 145
properties, 147
online event (cluster module), 178
operators
aggregation, 290
assignment, 18
conditional, 20
options object, 272
options parameter, group() method, 287
or() method, 309
order model controllers, shopping cart, implementing, 553-554
order schema, shopping cart, defining, 548-549
orderBy filters, AngularJS, 442-443
orderBy:exp:reverse filter (AngularJS templates), 438
ordering AngularJS filters, 441
originalUrl property (Request object), 365
otherDBRoles field, addUser() method, 213
Packaged Modules. See NPMs (Node Packaged Modules)
packages (Node.js), 42
Node Package Registry, 42
NPM (Node Package Manager), 43
NPMs (Node Packaged Modules), 42-47, 491
searching for, 44
page controllers, AngularJS, implementing, 537-538
Page model
defining, 517
implementing controller, 521-522
parameters
callbacks, passing additional to, 68
Express routes, applying in, 361-363
params property (config parameter), 473
partial option (options object), 272
partitioning methods, MongoDB, selecting, 343-344
passphrase option
https.request method, 140
tls.connect() method, 158
tls.createServer() method, 159
passport.authenticate() method, 510
path option (ClientRequest object), 123
path property
options parameter, 387
Request object, 365
paths
Express middleware, assigning globally to, 382-383
files, verifying existence, 110-111
Mongoose, 300
patterns, objects, prototyping, 29-30
pause() method, 146
pfx option
https.request method, 140
tls.connect() method, 158
tls.createServer() method, 159
photo controllers, implementing, 535-537
Photo model
defining, 518
implementing controller, 522
photo view, implementing, 527-528
pid property
ChildProcess object, 169
process module, 165
ping() method, 237
platform() method, 185
platform property (process module), 165
poolSize option (Server object), 229
$pop, 253
port option
ClientRequest object, 123
Socket object, 145
POST parameters, Express middleware, 386
POST servers, implementing, 135-136
preferGlobal directive (package.json file), 46
process execution, controlling, 165
controlling process execution, 165
I/O (input/output) pipes, 163-164
obtaining information from, 165-167
signals, 164
process property (Worker object), 180
clusters, implementing, 178-181
executable files, executing on another process, 171-172
executing executable files on another, 172
executing system commands in another, 171
spawning command in another, 174-175
spawning in another instance, 173-174
system commands, executing on another, 170
processing query strings and form parameters, 121-122
product model controllers, shopping cart, implementing, 552
product page view, shopping cart, implementing, 559
product schema, shopping cart, defining, 547-548
products view, shopping cart, implementing, 558
project() method, 323
$project operator, aggregation() method, 290
properties
ChildProcess object, 169
cluster module, 179
Socket objects, 147
protocol property (Request object), 365
provider() method, 416
providers, AngularJS modules, adding to, 414-416
publishing Packaged Modules, 49-50
$pull update operator, 253
$pullAll update operator, 253
purchases, shopping cart, 575-576
$push aggregation expression operator, 292
$push update operator, 253
put() method, 348
Put requests, sending, AngularJS, 473-475
puts() method, 350
pwd field, addUser() method, 213
quantity schema, shopping cart, defining, 548
queries, MongoDB
options, 272
sorting result sets, 283
query middleware (Express), 383-384
query operators, setting, 308-309
query parameter, group() method, 287
query property (Request object), 365
query router servers, starting, 345-346
query strings, processing, 121-122
queryRemover() method, 395
range-based sharding, MongoDB, 344
read database role (MongoDB), 214
read option (Schema object), 300
piping to Writable streams, 92
readAnyDatabase database role (MongoDB), 214
readlines() method, 350
readPreference option
options object, 272
Server object, 229
readWrite database role (MongoDB), 214
readWriteAnyDatabase database role (MongoDB), 214
redirecting responses, 373-374
reduce parameter, group() method, 287
regex() method, 309
rejectUnauthorized option
https.request method, 140
tls.connect() method, 158
tls.createServer() method, 159
release() method, 185
remoteAddress property (Socket objects), 147
remotePort property (Socket objects), 147
remove() method, 238, 306, 310, 320-322, 499
rename() method, 238
$rename update operator, 253
renameCollection() method, 235
renaming files, 116
repairing MongoDB databases, 353-354
replace property (AngularJS templates), 461
replication
MongoDB collections, 203
MongoDB databases, applying, 337-340
repository directive (package.json file), 46
req.logout() method, 511
Request object, 365
requestCert option (tls.createServer() method), 159
requests, routes, shopping cart, 551
require property (AngularJS templates), 461
required fields, MongoDB collections, forcing, 302
resolve() method, 191
$resource built-in service (AngularJS), 472
Response object (Express), 366-374
download responses, sending, 373
redirecting responses, 373-374
sending JSON responses, 369-370
sending responses, 368
response option (ClientRequest object), 124
responses, Express templates, rendering in, 378
responseType property (config parameter), 473
restrict property (AngularJS templates), 461
result sets, MongoDB queries, 278-283
resume() method, 146
resumeSession event (TLS Server objects), 159
retryMilliSeconds option (MongoClient connections), 230
reverse() method, 191
review view, shopping cart, implementing, 565
RIAs (rich Internet applications), 583
roles field, addUser() method, 213
root scope, AngularJS applications, relationship between, 419-420
$rootElement built-in service (AngularJS), 472
$rootScope built-in service (AngularJS), 472
$route built-in service (AngularJS), 472
routes
Express
applying parameters in, 361-363
model-based controller, implementing, 521-526
servers
implementing user controller, 496-501
shopping cart
model-based controller, 552-555
request, 551
view support, 587
run blocks, AngularJS modules, 414
runtime data binding phase, AngularJS life cycle, 188
safe() method, 307
safe option (Schema object), 300
save() method, 238, 262, 310, 392, 498
$sce built-in service (AngularJS), 472
schema method, 310
schemas
word_stats collection (MongoDB), implementing on an, 303
$set update operator, 253
$setOnInsert update operator, 253
scope destruction phase (AngularJS scope), 425
scope property (AngularJS templates), 461
scopes
emitting and broadcasting events, 428-429
expressions, 436
filters, 440
implementing hierarchy, 425-426
relationship between backend server data, 423-424
relationship between controllers, 420-421
relationship between root scope and applications, 419-420
relationship between templates, 421-422
sorting and ordering, 442
shopping cart, initializing, 571
script directive (AngularJS templates), 448
scripts directive (package.json file), 46
secure property (Request object), 365
secureConnection event (TLS Server objects), 159
secureProtocol option
https.request method, 140
tls.connect() method, 158
tls.createServer() method, 159
security, authentication, Express sessions, 392-393
seek() method, 350
select directive (AngularJS templates), 450
select() method, 307
sending responses, Express, 368-370
serializeFunctions option (database changes), 251
serializeUser() method, 510
MongoDB, 229
server types, sharding, 341
servername option, tls.connect() method, 158
servers
application, creating, 586-587
comments, creating, 520
GET, implementing dynamic, 132-133
HTTPS (Hypertext Transfer Protocol Secure), implementing, 139-140, 142
MongoDB driver, obtaining status, 244
query router, starting, 345-346
routes
implementing user controller, 496-501
shopping cart, creating, 550-551
TCP socket, implementing, 154-155
TLS (Transport Layer Security), implementing, 159
serverStatus() method, 237, 244
service() method, 415
service services (AngularJS), creating, 488
services
$interval, 481
$timeout, 481
$window, 478
creating constant services, 487
creating factory services, 487-488
creating service services, 488
creating value services, 487
integrating in modules, 488-489
session middleware (Express), 392-393
sessionIdContext option (tls.createServer() method), 159
sessions, Express
setEncoding() method, 146
setgid() method, 165
setgroups() method, 165
setKeepAlive(), 146
setNoDelay() method, 146
setOptions() method, 307
sets of documents, MongoDB, finding specific, 273-274
setShipping() function, 574-575
setTimeout() method, 146
settings property (cluster module), 179
setuid() method, 165
setup event (cluster module), 178
setupMaster() method, 179
sharding MongoDB collections, 203, 340-347
shared keys, MongoDB, choosing, 341
shared tag ranges, MongoDB collections, setting up, 347
shell client, MongoDB, accessing from, 209-212
shell commands, MongoDB, 210
shipping information, shopping cart, setting, 574-575
shipping view, shopping cart, implementing, 561
AngularJS modules and controllers, view support, 570-579
billing schema, defining, 547
billing view, implementing, 563
cart view, implementing, 560
checkout, 574
customer model controllers, implementing, 554-555
customer schema, defining, 549-550
defining address schema, 546-547
helper functions, 572
order model controllers, implementing, 553-554
order schema, defining, 548-549
product model controllers, 552
product page view, implementing, 559
product schema, defining, 547-548
products view, implementing, 558
quantity schema, defining, 548
request routes, implementing, 551
review view, implementing, 565
routes, model-based controller, 552-555
shipping information, setting, 574-575
shipping view, implementing, 561
shopping scope, initializing, 571
shopping view, implementing, 556
verifying billing, 575
signals, process, 164
signed property (options parameter), 387
signup routes, implementing, 496-497
signup view, implementing, 502
silent option (fork() function), 175
single field index (MongoDB), 334
single routes, assigning Express middleware, 383
size, limiting result sets by, 278
size() method, 309
size role (MongoDB), 221
$skip operator, aggregation() method, 290
skip option (options object), 272
$slice update operator, 253
slicing buffers, 81
snapshot() method, 307
snapshot option (options object), 272
SNICallback option (tls.createServer() method), 159
social media accounts, using as authentication sources, 508-512
Socket objects
events, 145
properties, 147
socket option (ClientRequest object), 124
socketOptions option (Server object), 229
socketPath option (ClientRequest object), 123
clients, implementing TCP, 151-152
servers, implementing TCP, 154-155
$sort operator, aggregation() method, 290
$sort update operator, 253
sort option (options object), 272
sorting, MongoDB query result sets, 283
sparse property (MongoDB indexes), 335
spawn() function, spawning processes in another instances, 173-174
splitting strings into arrays, 32
ssl option (Server object), 229
stale property (Request object), 365
statements
if, 20
static files, serving, 130-131
static middleware (Express), 384
stdin property (ChildProcess object), 169
stdio option, spawn() function, 173
stdout property (ChildProcess object), 169
sterr property (ChildProcess object), 169
$strcasecmp aggregation expression operator, 292
stream() method, 350
streaming data, Stream module, 83-92
streaming reads, files, 110
streaming writes, files, allowing to, 104
streams
compressing/decompressing, 95
output, synchronous writing to, 188-189
piping to Writable streams, 92
Transform streams, 90
strict option (Schema object), 300
strict routing setting (Express), 357
strings
arrays
converting into, 35
splitting into, 32
connection, components, 233
converting JavaScript objects to, 189
encoding between binary buffers, 75
escape codes, 30
JavaScript, 16
MongoDB, connecting to via, 232-234
replacing a word in, 32
searching for substrings, 32
styling
draggable views, 599
tables view, 603
view HTML files, 507
substrings, searching for, 32
$substr aggregation expression operator, 292
$subtract aggregation expression operator, 292
suicide property (Worker object), 180
$sum aggregation expression operator, 292
synchronous calls, file system, 97-98
synchronous reads, files, performing, 107
synchronous writes, files, performing to, 101
synchronous writing to output streams, util module, 188-189
system commands, processes, executing on another, 170
tabbed view templates (AngularJS), 588-590
tabbed views, implementing, 587-591
table controller, AngularJS, defining, 601-603
tables view, 603
initializing words database for, 605-607
TCP (Transmission Control Protocol), 143
clients, implementing, 151-152
servers, implementing, 154-155
tell() method, 350
template engines, Express
defining, 375
template property (AngularJS templates), 461
$templateCache built-in service (AngularJS), 472
templates
adding controllers to, 407
creating custom filters, 443-444
defining directive view, 462
directives, 433
modifying data displayed in rendered view, 440
obtaining data from scope model, 436
replacing elements, 463
scopes, relationship between, 421-422
transcluding external scopes, 463-464
views, 469
EJS, implementing user and authentication views, 501-507
Express
rendering in responses, 378
templateURL property (AngularJS templates), 461
text index (MongoDB), 334
textarea directive (AngularJS templates), 450
threaded web model versus event callbacks, 56-59
$timeout built-in service (AngularJS), 472, 481
timeout event (Socket objects), 145
timeout option
exec() function, 170
options object, 272
timeout property (config parameter), 473
timeout timers, 60
timers
dereferencing, 63
AngularJS, 481
interval, 61
timeout, 60
title property (process module), 165
TLS (Transport Layer Security)
clients, implementing, 157-158
servers, implementing, 159
tls.connect() method, options, 158
tls.createServer() method, 159
tmpdir() method, 185
toArray() method, 240
toJSON() method, 310
toJson() method, 404
$toLower aggregation expression operator, 292
toObject() method, 310
toString() method, 310
totalmen() method, 185
touch() method, 392
$toUpper aggregation expression operator, 292
transclude property (AngularJS templates), 461
Transform streams, 90
transformRequest property (config parameter), 473
transformResponse property (config parameter), 473
trust proxy setting (Express), 357
try/catch blocks, error handling, 36
TTL property (MongoDB indexes), 335
ucs2() method, 75
uid option, spawn() function, 173
unique property (MongoDB indexes), 335
unlink() method, 350
$unset update operator, 253
unwind() method, 323
$unwind operator, aggregation() method, 290
update() method, 238, 306, 310, 316-319
update operators, databases, 252-253
updateUser route, implementing, 498
updating
documents in MongoDB collections, 224-225
documents in Mongoose, 316-319
upgrade option (ClientRequest object), 124
uppercase filter (AngularJS templates), 438
uppercase() method, 404
upsert option (database changes), 251
URL object, 120
url property (config parameter), 473
URLs (uniform resource locators)
resolving components, 121
user accounts
MongoDB
assigning database roles to, 214
configuring access control, 216-218
removing, 215
user controller routes, servers, implementing, 496-501
user field, addUser() method, 213
user login routes, implementing, 497
user signup routes, implementing, 496-497
user views, implementing, 501-507
userAdmin database role (MongoDB), 214
userAdminAnyDatabase database role (MongoDB), 214
users, websites, 8
userSource field, addUser() method, 213
utf8() method, 75
utf16le() method, 75
object types, checking, 188
objects, inheriting functionality from other, 190
streams, synchronous writing to output, 188-189
strings
converting JavaScript objects to, 189
validate() method, 310
validation framework, Mongoose, 326-327
value() method, 415
value services (AngularJS), creating, 487
values, functions, returning from, 25-26
variables
functions, passing to, 25
verifyBilling() function, 575
version directive (package.json file), 46
version property (process module), 165
versions property (process module), 165
view cache setting (Express), 357
view engine setting (Express), 357
views
AngularJS templates, 433-434, 445, 447, 469
creating custom filters, 443-444
creating directives to extend HTML, 461-467
authentication, implementing, 501-507
comment, implementing, 532
comment thread, implementing, 530-531
draggable, 607
index, implementing, 503
login, implementing, 504
routes, support, 587
shopping cart
billing view, 563
cart view, 560
product page view, 559
products view, 558
review view, 565
shipping view, 561
shopping view, 556
signup, implementing, 502
style, adding CSS code to, 507
tables
AngularJS, 603
initializing words database for, 605-607
weather
defining, 595
views setting (Express), 357
w option
database changes, 251
MongoClient connections, 230
watcher registration phase (AngularJS scope), 424-425
weather controller, AngularJS, defining, 594
weather service view, implementing, 592-595
weather view, AngularJS
defining, 595
web development framework, 7-11
webpages
comment thread view, implementing, 530-531
comment threads, adding to, 515-541
comment view, implementing, 532
photo view, implementing, 527-528
webservers, 10
implementing application database connection, 494
websites, users, 8
where() method, 309
$window built-in service (AngularJS), 472, 478
withCredentials property (config parameter), 473
word_stats collection (MongoDB), implementing schema on, 303
work
scheduling, nextTick() method, 63-64
worker property (cluster module), 179
workers property (cluster module), 179
piping from Readable streams, 92
write concern levels, MongoDB, 228
writeFile() method, 350
wtimeout option
database changes, 251
MongoClient connections, 230
xsrfCookieName property (config parameter), 473
xsrfHeaderName property (config parameter), 473
Zlib module, data compression/decompression, 93-95