Reading /Searching a text from a text file OR PDF in mongodb (fs.files/fs.chunks)

269 views
Skip to first unread message

keesara

unread,
Nov 11, 2017, 4:11:12 PM11/11/17
to mongodb-user

Does mongo shell  commands support to retrieve / search a words from a text file or PDF or Excel files.

All My files all stored in MongoDB (fs.files/fs.chunks) and I am referring my files in a main collection using _id with dbref's.
I want to search a few words from a main collection :
Example : 
>db.fs.files.find().pretty()
{
        "_id" : ObjectId("5a0257610f32472c6c5740c0"),
        "chunkSize" : 261120,
        "uploadDate" : ISODate("2017-11-08T01:01:21.350Z"),
        "length" : 196172,
        "md5" : "a1fec9f5c652c6d844e2bf35bc08eaae",
        "filename" : "test.txt"
}

db.abc.insert({"_id": "1",
"project": {
 "$ref": "fs.files",
"$id": ObjectId("5a0257610f32472c6c5740c0"),
"$db": "dbname"},
"pp": "987-654-222",
"descr": "circuitboard"
 }
 )
Now , Want to  search a words from my binary file ( text.txt) at Mongo shell level.

Thanks

keesara

unread,
Nov 14, 2017, 2:43:36 PM11/14/17
to mongodb-user

Does mongodb shell commands (Full text Search)  support to retrieve / search a words from a text file or PDF or Excel files?

Thanks

Wan Bachtiar

unread,
Dec 11, 2017, 1:54:54 AM12/11/17
to mongodb-user

Does mongodb shell commands (Full text Search) support to retrieve / search a words from a text file or PDF or Excel files?

Hi Keesara,

No, MongoDB Text Search is to perform a text search of string content of document field(s), as opposed to a binary/chunk content.

Perhaps you can try to extract descriptions, title, or keywords that you would like to be searchable from the files and store it within a MongoDB document.

See also Text Indexes

Regards,
Wan.

Reply all
Reply to author
Forward
0 new messages