Posts

Showing posts from June, 2023

MongoDB Helpful Queries

Image
While doing the development everyones know that no one can remember all of the queries and commands. So in the blog I am covering most used Mongo DB queries. Mongo DB Queries By Education Funda Mongo DB Queries For Studio 3T and In Your Code Fetch Queries: db . getCollection ( "collectionName" ). find ( { FILTER_COLUMN_NAME : 'VALUE' }, { PROJECTION_COLUMN_NAME_1 : 1 , PROJECTION_COLUMN_NAME_2 : 1 } ) Get Duplicates Records db . getCollection ( "collectionName" ). aggregate ([ { "$group" : { "_id" : "$DUP_COL_NAME" , "count" : { "$sum" : 1 } } }, { "$match" : { "_id" : { "$ne" : null } , "count" : { "$gt" : 1 } } }, { "$project" : { "DUP_COL_NAME" : "$_id" , "_id" : 0 } } ]) Count Query db . getCollection ( "collectionName" ). countDocuments ( { FILTER_COL_1 : ...

How To Create S3 Bucket In AWS And Connect With Node JS

Image
a AWS S3 Bucket - Education Funda Create Policy Add ARN Create User as Allow and Create Role ? Add s3-user-policy as permission Now go into user and create access and secret key

Python Convert List of Strings/Numbers to Array

Image
When we are working many times we have a requirements where we need to convert list of data from excel or anything to arrays so that we can filter data from DB with in array conditions. Python Programming Step 1: You should have Python installed in your system to run it. Step 2: Create a Directory and Open that directory in VS Code Editor. Step 3: Create 1 file any-name.py. Step 4: Put below codes in created file: with open ( 'list.txt' , 'r' ) as f : content = f . read (). split ( " \n " ) for i in range ( len ( content )): contentLine = content [ i ] if len ( contentLine ) < 10 : print ( contentLine ) content [ i ] = contentLine . rjust ( 10 , '0' ) with open ( 'array.txt' , 'w' ) as f : f . write ( '[" {} "]' . format ( '", "' . join ( content ))) Step 5: Now create 2 files list.txt and array.txt . Step 6: Put some list of any da...