MongoDB data types
String:
You know what it is!Integer
: This type is used to store a numerical value. Integer can be 32 bit or 64 bit depending upon your server.Boolean
: True/FalseDouble
: This type is used to store floating point values.Arrays
: [list, of, elements]Timestamp
: This can be handy for recording when a document has been modified or added.Object
: This datatype is used for embedded documents. Like {"images": {"a": "ali", "b": "reza"}}Null
: This type is used to store a Null value.Date
: This datatype is used to store the current date or time in UNIX time format. You can specify your own date time by creating object of Date and passing day, month, year into it.Object ID
: This datatype is used to store the document’s ID.There are some more like
Code
, Regex
and so which is used less than other data types.#mongodb #data_type #mongo #database #collection #object
Minio
is an object storage server that is compatible with Amazon S3
. You can run your own object storage server using docker:- https://docs.minio.io/docs/minio-docker-quickstart-guide
And you can use its
Python SDK
in order to talk to its endpoint API:- https://github.com/minio/minio-py
It's usage is very simple and elegant. If you are unfamiliar with object storage read more here:
- https://en.wikipedia.org/wiki/Object_storage
#minio #python #sdk #docker #object_storage
docs.minio.io
MinIO | Learn more about MinIO's Docker Implementation
The MinIO Docker Quickstart Guide offers examples, code and documentation for those using Docker to run MinIO
How to upload file into
Now you just need the region, endpoint and access key, secret key which you would be given after purchase:
#python #object_storage #boto3 #file_upload
Amazon object storage
using boto3
?pip install boto3
Now you just need the region, endpoint and access key, secret key which you would be given after purchase:
client = session.client('s3',
region_name=YOUR_REGION,
endpoint_url=YOUR_HOST,
aws_access_key_id=YOUR_ACCESS_KEY,
aws_secret_access_key=YOUR_SECRET_KEY)
client.upload_file(file_path, # Path to local file
obj_config['spacename'], # Name of Space
'YOUR_FILE_NAME.txt', # Name for remote file
ExtraArgs={"Metadata": {'user-id': USER_ID} }) # metadata
NOTE:
in the name of the file you can pass /
like my/file/here.txt
. Now it will create directory (virtually) in the remote object storage.#python #object_storage #boto3 #file_upload