Code Monkey home page Code Monkey logo

Comments (9)

michaelklishin avatar michaelklishin commented on September 7, 2024

One question: how do you verify that metadata is not set? I will take a look

from monger.

jassinm avatar jassinm commented on September 7, 2024

thanks using mongo js console db.fs.files.findOne({filename:basename})

from monger.

michaelklishin avatar michaelklishin commented on September 7, 2024

So far I could not reproduce this. I improved test coverage for monger.gridfs (GridFS definitely needs some love in Monger, sorry about that) and the metadata I store is there.

With a small app that looks like this:

(ns monger-i27.core
  (:require [monger.core       :as mg]
            [monger.collection :as mc]
            [monger.gridfs     :as mfs])
  (:use monger.conversion))

(defn -main
  [& args]
  (mg/connect!)
  (mg/set-db! (mg/get-db "monger_issue27"))
  (let [path  (first args)
        fname "created.by.monger.bin"]
    (println "Storing " path)
    (mfs/store (mfs/make-input-file path)
               (.setFilename fname)
               (.setMetaData (to-db-object {:some "metadata"})))
    (println "Done")
    (println (mfs/files-as-maps {:filename fname}))))

I get this (shell history):

All namespaces already :aot compiled.
Storing  /Users/antares/.gitignore
Done
({:_id #<ObjectId 4fcc7e6503649fbe0af95482>, :chunkSize 262144, :length 427, :md5 1942f1e69c1d7354f93e2cf805894a9c, :filename created.by.monger.bin, :contentType nil, :uploadDate #<Date Mon Jun 04 13:22:45 MSK 2012>, :aliases nil, :metadata {:some metadata}} {:_id #<ObjectId 4fcc7ef6036404fb33e6d31c>, :chunkSize 262144, :length 427, :md5 1942f1e69c1d7354f93e2cf805894a9c, :filename created.by.monger.bin, :contentType nil, :uploadDate #<Date Mon Jun 04 13:25:10 MSK 2012>, :aliases nil, :metadata {:some metadata}})
 /tmp/monger-i27 mongo monger_issue27                              
MongoDB shell version: 2.0.5
connecting to: monger_issue27
> db.fs.files.findOne({filename: "created.by.monger.bin"})
{
    "_id" : ObjectId("4fcc7e6503649fbe0af95482"),
    "chunkSize" : NumberLong(262144),
    "length" : NumberLong(427),
    "md5" : "1942f1e69c1d7354f93e2cf805894a9c",
    "filename" : "created.by.monger.bin",
    "contentType" : null,
    "uploadDate" : ISODate("2012-06-04T09:22:45.634Z"),
    "aliases" : null,
    "metadata" : {
        "some" : "metadata"
    }
}

from monger.

michaelklishin avatar michaelklishin commented on September 7, 2024

By the way, files-as-maps is a function I just added. I am pushing a new snapshot that will have it.

from monger.

jassinm avatar jassinm commented on September 7, 2024

many thanks for adding some love to gridfs. works great

from monger.

michaelklishin avatar michaelklishin commented on September 7, 2024

@locojay can I close this?

from monger.

jassinm avatar jassinm commented on September 7, 2024

closed

from monger.

michaelklishin avatar michaelklishin commented on September 7, 2024

Thanks. I will release a new beta in about a day.

from monger.

michaelklishin avatar michaelklishin commented on September 7, 2024

By the way, a new doc guide is up: Using GridFS with Clojure

from monger.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.