r - what is used to write functions within mongoDB/mongolite? -


i'm learning mongolite/mongodb right now, , came across this:

https://cran.r-project.org/web/packages/mongolite/vignettes/intro.html

inside saw code this:

tbl <- m$mapreduce(   map = "function(){emit({cut:this.cut, color:this.color}, 1)}",   reduce = "function(id, counts){return array.sum(counts)}" ) 

can tell me these functions written in? don't think r functions.

the r language allows create environments put functions referenced $-operator 1 pull items list. m$mapreduce calling r function , sending text database engine: http://docs.mongodb.org/manual/reference/command/mapreduce/ if install package , execute help(pac=mongolite) see package has single exposed function, mongo allows of function calls. can work through examples on page , vignette.

(note: error if not first install , set database executable.)

if execute mongolite loaded list of objects in environment defined when mongo function created:

ls(envir=environment(mongo)) 

there set of objects in environment appear hold might interested in:

[14] "mongo_collection_aggregate"        [15] "mongo_collection_command"          [16] "mongo_collection_command_simple"   [17] "mongo_collection_count"            [18] "mongo_collection_create_index"     [19] "mongo_collection_distinct"         [20] "mongo_collection_drop"             [21] "mongo_collection_drop_index"       [22] "mongo_collection_find"             [23] "mongo_collection_find_indexes"     [24] "mongo_collection_insert_bson"      [25] "mongo_collection_insert_page"      [26] "mongo_collection_mapreduce"        [27] "mongo_collection_name"             [28] "mongo_collection_new"              [29] "mongo_collection_remove"           [30] "mongo_collection_rename"           [31] "mongo_collection_stats"            [32] "mongo_collection_update"      

Comments

Popular posts from this blog

python - Healpy: From Data to Healpix map -

c - Bitwise operation with (signed) enum value -

xslt - Unnest parent nodes by child node -