##' OP_INSERT
##'
##' See <URL>
##' This formats a message to be inserted into Mongo.
##'
##' @param doc list to be inserted
##' @return raw vector
op_insert <-
function(collection, doc){
## header is sent first, but is added last
fut_use <- numToRaw(0, nBytes = 4) # reserved for future use
full_name <- encode_cstring(collection) # full collection name
to_insert <- encode_document(doc)
rawl <- c(fut_use, full_name, to_insert)
header <- make_header(2002, length(rawl))
return(c(header, rawl))
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.