1.2.3-SNAPSHOT permalink Arrow_down_16x16

insert-dataset

incanter.mongodb

  • (insert-dataset mongodb-coll dataset)
Inserts the rows of the Incanter dataset into the given MongoDB collection.

Examples:

(use '(incanter core datasets mongodb))
(use 'somnium.congomongo)

(def data (get-dataset :airline-passengers))
(view data)

;; a MongoDB server must be running on the localhost on the default port
;; for the following steps.

(mongo! :db "mydb")
(mass-insert! :airline-data (:rows data))

;; notice that the retrieved data set has two additional columns, :_id :_ns
(view (fetch-dataset :airline-data))


0 Examples top

Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source incanter/mongodb.clj:104 top

(defn insert-dataset
  "Inserts the rows of the Incanter dataset into the given MongoDB collection.

   Examples:

   (use '(incanter core datasets mongodb))
   (use 'somnium.congomongo)

   (def data (get-dataset :airline-passengers))
   (view data)

   ;; a MongoDB server must be running on the localhost on the default port
   ;; for the following steps.

   (mongo! :db \"mydb\")
   (mass-insert! :airline-data (:rows data))

   ;; notice that the retrieved data set has two additional columns,  :_id :_ns
   (view (fetch-dataset :airline-data))


"
  [mongodb-coll dataset]
    (mass-insert! mongodb-coll (:rows dataset)))
Vars in incanter.mongodb/insert-dataset: defn
Used in 0 other vars

Comments top

No comments for insert-dataset. Log in to add a comment.