Importing datafiles

Hello, I’ve just started to explore Mongodb. I haven’t installed it yer, I’m just using the Mongo atlas cluster through the online shell.

Please help we clear out a few questions:

  1. Can MongoDB import, read and retreive data from images(png, jpg, svg format).
  2. Does MongoDB import data only in json, bson format or other data files like .xlsx, .pdf, .html etc as well?
  3. Is there a way to import data from Zoho analytics into MongoDB?

With GridFS you may get any file type inside MongoDB.

I do not know about Zoho.

Welcome to the MongoDB community @Praxiee !

As @steevej noted, you can use the GridFS specification to store files in MongoDB, but file contents will be opaque binary blobs as far as MongoDB drivers and server are concerned.

For your specific questions:

  1. Can MongoDB import, read and retreive data from images(png, jpg, svg format).

You can store any file type as a binary blob in MongoDB using GridFS and add optional metadata that might be useful for queries.

MongoDB drivers and server do not have support for interpreting arbitrary file types or extracting metadata, but you should be able to find suitable libraries for common file formats in your favourite programming language.

If your general use case is storing and interpreting the contents of binary files, you may also want to consider using an existing Document Management System which is designed for that purpose rather than building a bespoke solution.

  1. Does MongoDB import data only in json, bson format or other data files like .xlsx, .pdf, .html etc as well?

Official MongoDB tools like mongoimport support common text-based data exchange formats like JSON, CSV (comma delimited), and TSV (tab delimited).

For other file formats, you should be able to find libraries and tools with read or write support. For example, openpyxl is a Python library to read/write Excel 2010 xlsx/xlsm/xltx/xltm files. Excel files can include more complex content like formulas and references, so I recommend exporting to a text-based format like CSV if you want to transfer data between environments.

  1. Is there a way to import data from Zoho analytics into MongoDB

That depends on the sort of data you are trying to export from Zoho Analytics and how (or if) you plan to automate any integration.

General approaches might be:

Regards,
Stennie

2 Likes

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.