fabiochiu/medium-articles huggingface dataset:
How To Setup a Bitcoin Node Using Source Code [Linux]?
By: Arnish Gupta
Tags: Cryptocurrency Developer, Bitcoin, Blockchain, Cryptocurrency, Blockchain Development

How To Setup a Bitcoin Node Using Source Code [Linux]?

Bitcoin is the most popular cryptocurrency and its price is continuously grown up in 2020. Many developers are looking for a guide to set up a bitcoin node. I heard the word bitcoin first time in 2016 and I have worked on blockchain development for more than the last two years. Bitcoin code is written in C++ . We need to compile a code (if you want to do some changes to the code you can do it) then setup the node. So let’s look at the steps with a fresh operating system. I am dividing this article into two parts. The first part is to compile the source code and the second part is for setup the node.

Photo by André François McKenzie on Unsplash

If you want to set up only a node then you can skip the source code compilation process and download the bitcoin executable files directly from here. Extract the file and check bin folder.

Part 1: Source Code Compilation Guide

Step 1.

Update all the repositories apt-get update -y and download the latest bitcoin code. you can get all the releases from here.

wget https://github.com/bitcoin/bitcoin/archive/v0.20.1.tar.gz (If wget command not found then apt-get install wget -y )

Step 2.

Extract the file tar -xvzf v0.20.1.tar.gz

Install some helper libraries

AutoConf apt-get install autoconf -y Libtool apt-get install -y libtool G++ apt-get install g++ -y Package Config apt-get install pkg-config -y All Dev apt-get install libboost-all-dev -y LibDB Package apt-get install libdb++-dev -y Utils apt-get install bsdmainutils -y Essential for make apt-get install build-essential -y

Step 3.

We are ready to compile the code. Go into the extracted directory (bitcoin-0.20.1) and execute the command ./autogen.sh

If everything goes good then you will see the output like this.

root@05664050921e:~/bitcoin-0.20.1# ./autogen.sh Llibtoolize: putting auxiliary files in AC_CONFIG_AUX_DIR, 'build-aux'. libtoolize: copying file 'build-aux/ltmain.sh' libtoolize: putting macros in AC_CONFIG_MACRO_DIRS, 'build-aux/m4'. libtoolize: copying file 'build-aux/m4/libtool.m4' libtoolize: copying file 'build-aux/m4/ltoptions.m4' etc...

Step 4.

Configure the project with incompatible DB version because it required only 4.8 version and we don’t need to track the dependency.

./configure --with-incompatible-bdb --disable-dependency-tracking

Step 5.

Now we are ready to make the executable files using the make command. It will take time about an hour so don’t worry about that.

[Optional] You can run this command in the background using the article.

After successfully execute the make command then you can check in the src folder there are some executable files created.

## These files are 1. bitcoind

2. bitcoin-cli

3. bitcoin-tx

4. bitcoin-wallet

Congratulations !! You have compiled the bitcoin code, now a new journey started to setup the bitcoin node.
8 ICO Smart Contract Features
Tags: Blockchain Startup, Blockchain, ICO, Blockchain Technology, Blockchain Development

8 ICO Smart Contract Features

8 ICO Smart Contract Features

Crowdfunding using ICOs?

Congratulations! ICOs are a great choice for crypto project fundraising.But there are things you need to know about before you start.

Hopefully, this series will help you get started with ICOs and how they can work for you.

What are Smart Contracts?

Smart Contracts are self-executing programs that work based some set criteria.

They are totally hands-free and tamper-proof.Once you implement a smart contract, it cannot by altered by anyone.This helps establish trust with your investors.

8 Key ICO Smart Contract Features

Capped Contracts

The Capping features allows you to set price caps, depending on what your minimum funding goal is to start the project and what your maximum goal is.

Mintable Tokens

What do you do when you’ve exhausted all your tokens but still have investors coming? You can mint extra coins which the ERC20 tokens standard doesn’t cover.

Multistig Contracts

For transactions that need multiple signatures to be approved, multistig contracts are a great option.

Finalizable Contracts

Enables you to add extra finalizations once the crowdsale is finished.

Upgradable Contracts

Allows you to upgrade contracts and transfer tokens to new contracts,as your campaign progresses.

Refundable Contracts

If your campaign Was to unfortunately be unsuccessful in meeting.The funding soft-cap for starting the project,you can easily refund the investor’s money.

Burnable Tokens

You can burn unused tokens after a crowdsale by sending them to a sealed wallet, increasing the value of your tokens.

Time Vault Contracts

Allows you to establish time limits, before which a user won’t be able to withdraw their tokens.

Thanks For Reading

Smart Contracts are one of the most remarkable features that blockchain technology offers. These programs provide high levels of flexibility and practicality for enterprise businesses to automate their tasks, seamlessly. So, let’s take a look at how Smart Contracts benefit ICOs, what the features are, and how you can make the most out ofthem for your Blockchain Project.

This is BlockchainX, and here is everything you need to know.
The Sopranos episode review — 1.13 — I Dream of Jeannie Cusamano
By: Patrick J Mullen
Tags: The Sopranos, Drama, Thriller, TV, 1990s

Original air date: April 4, 1999

Director: John Patterson

Writer: David Chase

Rating: 8/10

Tony realizes that Pussy isn’t the FBI informant, but it’s the recently released from prison Jimmy Altieri (Joe Badalucco, Jr.). He’s promptly killed.

Dr. Melfi brings up the possibility that Tony’s mother might be behind his attempted assassination, and at first, Tony flies off the handle.

But after some time, he realizes she’s probably right. And he suspects that her dementia is actually her faking it all. It helps that he also hears an FBI recording of her talking to Junior.

Tony’s gang goes on a rampage, killing a couple of Junior’s underlings.

This episode is pretty damn exciting. It’s faster paced than most of the episodes in the season, and it still packs the drama and fine acting that you’d expect.
Tree
Tags: Dart, Mystery, Fiction, Thriller, Psychology

There was an empty field, wild with unkept weeds. In the midst of this boondocks stood an aged masterpiece thriving on its own.

It swayed and bent amidst the elements, moving with the raging winds that were thrusting with force. The hail followed, raining down like tiny weapons with a surprising hit.

We ran hard to the embrace of the large welcoming trunk. It was rippled with groves, as wrinkles grace the face, bringing solace as our backs lay against its support. The towering branches, thick and full of leaves, provided shelter from the impending storm.

The tree, untouched by human hands, lost its peaceful presence. There was a discomfort now, a foreign pressure. The roots beneath the surface began to emanate. Something was amiss.

We laughed, stomping the ground with our hands and feet. We found a place of safety in what felt like wasteland. Throwing a bag down, we reach inside, grabbing a pack of cigarettes and a bottle of vodka.

Time passes on and the storm escalates. We don’t notice, except for the few speedy pellets that sniper through. The bottle almost finished and the pack half down. Butts scattered around the grass.

Our voices get louder and so does the rowdiness. We fling and turn, hitting the bark, tearing pieces from its core. We carve our initials as proud signatures of our presence.

Now the tree can only feel fear.

The rolling thunder subsides leaving it secure to venture. We smash the empty bottle which flickers shards of glass in our wake. We throw unfinished cigarettes behind us.

One catches the bag.

A spark.

Ignition hits and a fire is born. It sets ablaze, finding a way to creep up the newly exposed cracks.

The wind rustles and spreads it faster.

We hear a sound and turn around. The tree, now lit in scarlet reds, screams in terror as the flames reach higher.

With the reflection mirrored in our eyes — we just stand there and watch.
Second Chances
Tags: Mystery, Fiction, Dark, Thriller, Psychology

He struck again and this time with ease — getting close enough to watch the suffering. She begged and cried, aching with pain that permeated her whole being. He just stood there, watching, unwavering. There was nothing she could do.

She closed her eyes, felt the throbbing in her head and the turmoil in her heart. This was my choice. I chose this.

Tears streamed down her checks like warm rain drops. It poured until it hurt.

He passed her the bottle and without hesitation she drank. It burned and she wanted more. Each sip an annihilation.

She began to feel heavy and limp. Her eyelids became a weighted blanket. She fought to keep then open. To keep her consciousness alive.

How long does this take?

He stares, shrugs his shoulders and walks away.

She is left with herself in these final moments. Only her thoughts remain while the body slowly shuts down. Organ by organ. A complete numbness.

As her breathing labours, she lays down, letting go. An almost peaceful serenity. Her memories flash by like a wicked reminder of why she ended up here.

She glances at the bottle once more.

The final dosage.

With a deep sigh she reaches for her demise.
Deliverance in the Dakotas
By: Eric Warren
Tags: Diane Lane, Movies, Thriller, Kevin Costner

Reviewers have been mixed on this one, and I also have mixed feelings.

Grandma and Grandpa search for their missing Grandson, suspecting he is being abused by his father. That setup propels the story forward nicely, but where it ends up, and where it ends is a bit problematic. Is “Let Him Go” a Thriller? A Drama? A Septuagenarian re-kindled romance? It doesn’t seem sure, but it sure ends with a bang. Literally.

Casting Kevin Costner and Diane Lane seems like a good idea, and these two professionals are fine in the scenes they share — primarily just the two of them. The third reel features a sort of Deliverance-style rural horror show where British Actress Lesley Manville nearly steals the show as the “Ma Barker” style Matriarch.

You want the Gramps’s to escape with the kid. Spoiler Alert: they might, and they might not. Again, how things evolve from relatively slow burn menace to something out of “The Untouchables” (DePalma’s film, not the milquetoast remake of the French soaper).

If you love, or even like either Costner, or Lane, or both this is a good bet. If you like Lesley Manville you kind of have to see it. Otherwise, you might must pass.
Movie Review: Shut In (2016)
By: Patrick J Mullen
Tags: French, Movie Review, Thriller, Canadian, Horror

Yikes, this movie is dry. Oh, and it’s also insane, with one of the dumbest plot twists I’ve ever seen.

Naomi Watts does what she can. There’s actually a reasonably talented cast here, but they’re given just the worst story possible to display their talents.

Most of what happens is either a hallucination or a dream, because there just isn’t much plot progression here. There are basically like three story beats, and the movie stretches them out. It’s a tiring watch.

Rating: 2/10
Ghoul House
By: Arjun Bhatla
Tags: Halloween, Mystery, Ghosts, Thriller, Suspense

As twenty-two-year-old Travis carefully approached the pebble stones of what is unusually known to be Ghoul House, he had a slight tinge of fear buzzing inside him. For nearly 3 years now, determined Travis was trying to prove there was nothing ghoulish about the dark area of mysterious land that eerily stood there solitary as. But weirdly enough nothing really added up in his lists of facts so he decided to give this uncanny house a visit. Pebbles crackled as he edged over them and the slight noise of a trickling stream filled his heart with horror. He slowly stepped towards the grandeur of the door, now to what seemed a creaky old garage door. It had a brass doorknob and a wooden frame with creases going up and down.

The clouds were darkening and the gravestone of poor Charky Grocer that stood there stock-still and silent as was mercilessly struck by lightning. What the peculiar thing about this door was not to be known but what it had engraved on it was slightly, no, very frightening: Knock Knock, Who’s there, Ghoul House!

Travis knocked and knocked but eventually came to an unusual conclusion of no one answering. Surprise surprise! Then he just did something very stupid. He got so frustrated he kicked the weak door open. Big mistake!

Ghosts and white spirits of some sort cruised out clouding his face with white. Eventually, it was over and Travis was absolutely petrified and dazzled. The spirits and ghosts zoomed into the wide world saying one thing: “We all just checked in, now nightmares can begin…”
When No One is Watching by Alyssa Cole & Gentrification
By: Sarah Keays
Tags: Book Blog, When No One Is Watching, Thriller, Alyssa Cole, Book Review

Book Review

When No One is Watching by Alyssa Cole & Gentrification

“Rear Window meets Get Out in this gripping thriller from a critically acclaimed and New York Times Notable author, in which the gentrification of a Brooklyn neighborhood takes on a sinister new meaning…” ~ Amazon

Alyssa Cole ~ Published September 1st 2020 by HarperAudio ~ 8.5 Hours ~ Adult Thriller ~ 4 Star Rating

Alyssa Cole tells a powerful and needed story with this thriller. To combat white reviewers, as a white reviewer, I have to specify that this is indeed a thriller. I’m new to the genre, but I know that fear is subjective and even though gentrification isn’t something that I fear, loads of other people do.

When No One is Watching is a story within a story. On the surface, it tells the tale of a Black woman designing a walking tour with a white neighbor after having a horrible experience with a walking tour as a consumer. Deeper down, this is a story of gentrification and how truly terrifying it is.

Imagine watching your entire town slowly disappear, being forced out of their homes by raised rent and taxes. Many reviewers also claim that this is a slow-paced book and they use that as an excuse as to why it’s “not a thriller.”

While they have a point that the book is slow-paced, so is gentrification. The pace is slow because the source of fear is slow-acting. To be honest, that’s why this book didn’t earn a full five star rating from me. It’s very slow and difficult to jump into, but it fits the plot and it reflects the tension of the story line.

Alyssa Cole also did a great job at inciting emotion. Throughout the first chunk of the book, I wanted to ring Kim’s neck. If you read it, you’ll know what I’m talking about. If not… be prepared to take some reading breaks to get some anger out. I was doing dishes while listening to the audio and there were certain points when soap was flying around the kitchen.

As I mentioned, I used Libby to listen to the audiobook. Susan Dalian and Jay Aaseng do a terrific job with performing this story. I highly recommend the audio if you’re going to read this awesome thriller.
Enjoy The Misty Months With These 5 Excellent Thrillers
By: Anirban Kar
Tags: Reading, Mystery, Books, Thriller, Winter

Imagine spending a wintery evening by the lake surrounded by a forest — all alone. The thin layer of mist barely touching the surface of the standstill waterline. The lake, reflecting the starry sky embalmed with the potion of nothingness. And as the cold gust of wind brushes the tip of your skin, the chilling sensation coupled with the whispering of the dry leaves shakes you from inside.

It feels spooky yet charming. It feels hollow yet so full. Above all, it looks so gloomy and colorful at the same time.

You speak to yourself: the very soul of this season feels so sinister. Yet, it has a wicked charm to it.

Then you get back home. Now it is hot and comfy. You know everything surrounding you. Your desk, bed, favorite chair, the cute little wind chime at the window, all the old familiar things.

But you are still feeling it. There is something about these chilly evenings. It makes you crave something intriguing. And thus, you seek to stretch the wings of your imagination and walk the noir lanes to chase down mysteries.

So sit back, relax, grab a hot cup of coffee and enjoy these intriguing pieces of thrillers to celebrate the eerie winter months.
A house on fire (final part)
By: Sahil Katyal
Tags: Fiction, Short Story, Thriller, Suspense

Photo by Jesper Aggergaard on Unsplash

It was like someone had turned the heat all the way up. It felt like the floor of her kitchen, except that it was anything but that. As she opened her eyes, while still laying flat, she saw that the squirrel was sitting by her side. “Where am I? What have you done? And who are you?”, she asked three questions in the same breath, not knowing which one was more important. It felt like a bad dream, except that she never had dreams.

“You are in a world that you belong to. It’s still your house. It’s still your kitchen. Just that, you are on the other side of the Tamut.”, said the squirrel in a voice marked by a certain shrill.

“What is Tamut? Why have you brought me here?”

“I think you are ready. Come, let me show you.”

Once they got up, the squirrel asked her to turn back and pointed to a faint outline just meters ahead of them. There stood Paul, in a certain state of translucency, unaware of what was looking at him but seemingly delirious at not having found his love anywhere.

“Why can’t he see me?”, she exclaimed while frantically waving her hands. “What have you done?”, she asked again, this time in a tone that she herself did not know she was capable of.

“It is not I who has done anything. It is you. I have merely been a conduit to transfer you on the right side of the Tamut. For months you were wanting an escape, that takes you to a place which shows your life sans all the happiness. The beauty and comfort around you seemed transient to you. Isn’t this where you always wanted to be? Your own house, without the comforts that you felt you didn’t deserve. Your Paul, for example.”

“I want to go back! I don’t know what you are saying! You have mistaken me for someone else.”

“You can always go back. You just need to close your eyes and believe.”

And she knew she’d never be able to close her eyes again.

“But what about Paul?”, she asked the squirrel while suddenly realizing it was weird that she was talking to a squirrel. But what wasn’t weird around her?

“It’s tough for a few months. But it’s better in the longer run for him. For you, it’s the same as what it was earlier, what it is now and what it will be.”

Together, she and Paul looked at the refrigerator door once again. The house had been on fire for quite some time now.
She took a sip of her champagne.
By: Way Of Lisa
Tags: Short Story, Melodrama, Tragedy, Thriller, Short Story Writing

She took a sip of her champagne. Slightly startled by the chill of the sparkling wine slowly sliding down her throat. It took every bit of effort inside her body to keep that one sip down.

Although everyone around her told her what had happened called for a celebration, every inch of her body, every living cell, every membrane, quivered at the mere thought of celebrating. No one had been there. No one had seen what she saw, the smell of smoldering plastic, ash particles drifting in the air. There was no cause for celebration, not if this had been the way to get there. But how could she tell anyone? Especially now, with everyone ogling her every movement. One misstep and it could cause a thunder storm of misery that no one could see coming.

A drop of the bubbly elixir touched her lip and she flinched. Her hand trembling uncontrollably. How long would she be able to keep this up with no one noticing?
De Babord à Tribord, Ça Roule
By: Dr Jacques Coulardeau
Tags: Peur, Radio, Horreur, Thriller, Suspense

Dr Jacques COULARDEAU, PhD in Germanic Linguistics (University Lille III) and ESP Teaching (University Bordeaux II) has been teaching all types of ESP
The Hungry Wall
Tags: Short Story, Fiction, Thriller, History, Horror

The Hungry Wall

Photo by Jackson Simmer on Unsplash

I Trapped

“I live in a cottage in the deep woods. Come over for dinner, but not before 9 pm sharp,” an invitation too difficult to resist for a thirty-three-year-old bachelor.

Evan’s old car bumped down the gravel, screeching to a halt.

He looked at his watch.

Twenty minutes to nine.

Too early.

He couldn’t wait to see his attractive hitch-hiker who he met only a few hours ago. His burning desires melted down his patience.

The cottage stood there, tall, lonely, dark, and quiet. Its door, wide-open, beckoned him in.

Evan stepped inside.

The door swelled, roared, and disappeared.

Trapped…
‘The Call’ is Surprisingly my Favorite Movie of 2020
By: Giorgos Pantsios
Tags: 2020, Movies, Film, December Contest, Thriller

What a year for cinema. Many movies didn’t come out. Many people turned their backs to the big screen and gave a shot to streaming services.

To be honest, streaming services don’t quite do the thing for me when it comes to movies. The quality feels a little meh. When you take a look at my favorite movies, you won’t see any streaming service made movie.

Anyway, I only watched 16 movies released in 2020. The others were from the previous year. Yeah. This year feels like a failure to me. So I didn’t watch many of them.

This is where “The Call” comes in.

Why unexpectedly? It’s a thriller. And I am not a huge fan of thrillers. It’s Korean. I have seen 5 Korean films or less (fun fact, most of them came right after “The Call”).

When I put a movie at the top of my list for the year, it is probably a drama that makes me cry like a baby — Demolition(2015) I’m looking at you. Or a sci-fi that moves me vastly, like Interstellar(2014).

But this movie moved me in a different way. It had me squeeze my couch from the thrill. In a spoiler-free manner, let me explain about the movie.
Dreaming about future
By: Andrei Konstantinov
Tags: Creativity, Writing, Fiction, Thriller, Future

It was a slow summer of 3021. A team of burglars decided to rob a mansion.

They forged an electronic keycard, broke into the house, but all they found was huge boxes full of powdered milk. Little did they know, the mansion was damned and boxes weren’t just full of milk, but full of vampires as well.

Vampires are harsh: they don’t shoplift, pickpocket or mug, okay? They eat people and not even a first aid kit will help you.

Later at night all vampires crawled out of boxes and had a feast, they totally hijacked the night sky with their bat friends. Even Judge Dredd himself could not stop it. The party didn’t stop until the morning. Neighbours called the police and complained about noise, but it was a problematic neighbourhood and cops came only at noon. Our big-fanged friends were long gone back to their boxes and were sleeping soundly.

Policemen only found boxes and thought: “Well, looks like it’s a great milk, let’s take some as a payment for a false call”. I’m sure the reader has already guessed what happened next. Pretty funny, if you ask me.
A Forlorn Escape from the Yesterdays
By: Aiswarya Ravi
Tags: Short Story, Depression, Crime, Thriller, Suspense

“What time of the day is it?” Her frail mumble was heard nowhere in that abandoned room. She moved the messy hair on her face just to stare into the pitch darkness that gave no signs of escape. As she fumbled for her phone, she knocked down the leftover sip of vodka which was poured the day before. When she finally managed to fetch her phone, it was dead long back.

The migraine was paralyzing her. Passing out after that extra drink was not uninvited, but a whole day’s sleep had dehydrated her soul. She struggled to rise from the floor but failed. “He was right. Closing the window panes with papers has got nothing to do with shutting off people from life,” she smirked. “Saying that he was gone forever. He was not just my husband; he was the only one whom I was in contact with.”

After many failed attempts, she finally caught hold of her drawing stand and rose. She moved the black curtains just to stare into the plastered windows that looked like someone’s failed attempt to fix her shattered life with broken pieces of advice. The eeriness, born out of her imperfection, saw a ray of light leaking in through the uneven patch on the window panes.

“I don’t want to live with anyone. I don’t want to marry!” She could see herself screaming at her parents a year ago but was forced to marry Sandeep. Now, they are all gone, leaving behind her and her innate notion to shut people from life.

She switched on the lights. The yellow rays fell bluntly over the half-eaten food, ordered a few days ago, the broken glass and the spilt vodka, an unwashed plate and some forbidden pieces of art. The massive incomplete canvas which was half-painted red disturbed her. She searched for the leftover paint but realised it has all dried up.

She dragged herself into the balcony where the bright light pestered her for a while. She ran her fingers through the dusty rails, disturbed, and caught sight of a shawl lying on her balcony. “Must have flown from the top floor!” She slowly picked it up and brought it close to her nose, closed her eyes and took a deep breath… “Ahhh! Human smell!”

The uncle in the opposite flat still didn’t seem to give up. With the lit cigar, his whistle was a clear hook-up call, but she ignored. Suddenly, her heartbeat rose to see the trash van. She was nervous. She saw them load the saggy black sack into the van. “It was as thick as how I wanted,” she recalled the smell of Sandeep’s blood. “But the canvas is still incomplete,” she murmured.

The whistle from the other side was strong enough to interrupt her from caressing the abandoned cactus. Having fixed something, she decided to give a cold-blooded smile this time and the cactus got crushed in her palm, leaving behind no signs of hope.
A Dangerous Prisoner
By: Marvin Serwanga
Tags: Writing, Storytelling, Fiction, Thriller, Flash Fiction

Two armed guards stand watch in a high-tech security prison. Over a large metal door, one guard stands by the door, Rick. It’s his first day on the job. Beside him stands Vincent’s a veteran in this line of work. Rick looks at the door with curiosity..

“Who’s the girl?” He asks.

“Magdelene Grey, she’s dangerous. Don’t approach without your weapon,” Vincent replies.

“What’s the big deal?” The young guard inches closer.

“Careful!” Vincent yells.

Rick pauses and turns to Vincent.

“What?”

“Like I said, she’s dangerous,” Vincent speaks sternly.

Unbeknownst to Rick, his key lightly shifts on his hip, slowly being unhooked from his belt. Yet no one touches it.

“Just seems so extreme, you know?”

Vincent tuts, “trust me on this one.”

As Rick walks forward, there’s a click and the sound of a large opening. Rick turns and points his weapon into the cell.

“What did you do?”

Vincent’s voice trembles as he speaks.

“Nothing I-”

Rick feels a queasy feeling in his stomach, his feet no longer touching the ground. He looks ahead, beads of sweat form on his brow. Vincent immediately points at the cell and starts shooting.

Rick tries lifting his arm but cannot, it’s as if someone is clinging to it.

“Help!” Rick cries.

Vincent keeps shooting, but Rick stays floating on the air. Nothing has changed. Rick turns and looks to Vincent before being dashed into the prison wall. Knocking him out cold.

Magdalene slowly walks out of the prison, dressed in a ghostly white uniform. Her dark brown hair partially covers her eyes. She walks forward with a suspended orb of rubber bullets beside her.

Vincent desperately shoots at her, but the bullets stop right in front of her face. Magdelene smiles and tilts her head, Vincent’s neck snaps. She adds more rubber bullets to her collection and walks forward. The prison alarm sounds and screams follow as the chaos begins.
Accessing MongoDB URI from Heroku for MERN app
By: Shivani Gangadharan
Tags: Heroku, Environment Variables, Mern, Mongodb

In this blog, I will share what is the best way to access the Mongo URI for a MERN app deployed on Heroku.

Mostly, people create a dotenv file or a key.js file to store their Mongo URI and then probably add it to gitignore . In my opinion, that’s not the best thing to do, here’s why. If in the future, you wish to make your code publicly available, let’s say on Github, then it could create a security vulnerability in your project and your password might be visible in the repository’s commit history.

So what you need to do here is to add the Mongo URI on Heroku as config variables and then access it using process.env in your MERN app. This will prevent any unauthorised access to your database. Now let’s see how to get that done.

I will discuss both, the Heroku CLI method as well as GUI method here.
Introduction to MongoDB: A NoSQL Database
By: Naveen Singh
Tags: Nosql Database, Database, Mongodb Tutorial, Cli, Mongodb

What is Database?

In home you have refrigerator or fridge to store food, veggies and other items, so in electronic/digital world the food is called data and the refrigerator is known as Database.

What is NoSQL database?

Before NoSQL lets understand what is SQL database. SQL database has a defined structure to store data or information that is in the form of table(Row, Column) just like your refrigerator’s cabinet(well defined space).

SQL Database example

From above figure it can be noticed that all the data is in row, column format and none of the data is null. If any data is null or empty we have to write null there.

In NoSQL database there is no fixed structure that is there is no fixed number of column and the number of column can be different for individual entry or row.

MongoDB is a NoSQL database. Here are some points to be noticed:

Just like “table” in SQL database, MongoDB has “collections” where all the information is stored. In table we have rows and column then in collection we have “document” that contains “key value pair”. Column is called Key here. For example: Column name is “City” and for the first row the value is “Kanpur”. This can be written as{ “City” : “Kanpur”} for the first Document(first row). We will talk about it later. The document is stored in JSON format.

brief

To download MongoDB, click here and for installing video tutorial click here.

Let’s do some practical:

To start MongoDB, first set the path in cmd then type “mongod”. Then open another cmd and type “mongo”

First Step

Second Step

Don’t close any window till our operation completes.

We can create multiple document at a time using: db.datatype.insert([{document1},{document 2},{document n}])

OPEN THE IMAGES AND ANALYSE WHAT IS HAPPENING. ALSO READ THE PARAGRAPHS AND LINES WRITTEN OVER THERE.

We learnt how to insert document in collection. Now we will see how to find the required document in the list of document.

What if we have condition like less than, not equal, greater than etc then we have to use:

take the first letter of both less than i.e. l and t so we wrote $lt and so on.

greater than = gt, less than =lt, not equal=ne, less than or equal to=lte, etc.

Now how to delete collections, documents and database too:

Before deleting the database first run the command “db” to check the current db.

Next time we will cover method and functions

If something is wrong please comment down below.

Thank you for reading!!!
Insert Object inside an object in MongoDB
By: Js Developers
Tags: Object Oriented, Medium, Nodejs, Mongodb Tutorial, Mongodb

Here We’ll discuss how we can insert an object inside an existing object in MongoDB

$set plays an important role here as, If the field does not exist, $set will add a new field with the specified value…

Photo by Campaign Creators on Unsplash

Suppose we have an exiting document as following

{

“firstName”: “John”,

“lastName”: “Doe”,

“age”: 50,

“address”:{

“current address”: “USA”,

},

“metadata”:{

“Primary School”:”YES”,

“High School”:”YES”,

“Graduate”:”YES”,

“Post Graduate”:”NO”,

“Professional”:”YES”,

},

}

and the requirement is to insert following object inside address

“permanent address” : {

“state” : “UP”,

“country” : “India”

}

For this query will be
(Video Series)⚡️Docker Practical Guide⚡️Part-3: Learn Docker-Compose with Node and Mongo in 2021
By: Shahjada Talukdar
Tags: Docker Compose, Dockerfiles, Nodejs, Docker, Mongodb

It’s a Series on DOCKER- ⚡️DOCKER Practical Guide⚡️

I have used NodeJS, But all the Docker stuff in this series can be applied in any technologies like — Java, .Net, Python, Go, you name it.

In today’s video, we will see how we can use Docker-Compose to simplify running multiple containers manually with a single command.

Enjoy 🌸

In this Series, I will post the following topics and more 🙌

As I will show some fun Docker stuff we might need in our day-to-day work, That’s why the name of the series is — ⚡️DOCKER Practical Guide⚡️

SUBSCRIBE to YouTube Channel — https://www.youtube.com/c/TheDestroDevShow?sub_confirmation=1

LIKE FB Page — https://www.facebook.com/the.destro.dev.show/

Follow on Twitter — https://twitter.com/destro_mas

Follow on DEV — https://dev.to/destro_mas

Made with ❤️ in Berlin!
Todo app with FastAPI, React, MongoDB(motorIO)
By: Valentin Vareskic
Tags: React, Fastapi, API, Python, Mongodb

Backend

So first we have to create a place where we are gonna store our project, head out and create a main folder, mine is called “todo-fastapi-react-mongo” and in there create two new folders, server and client.

Starting Folder Structure

Open a terminal and change directory to server, now we’ll create our virtual environment and install our packages (Python3.6+). More info on virtual environments can be found here.

$ cd server

$ server/python3.8 -m venv venv

$ server/source venv/bin/activate

$ server/pip install fastapi

$ server/pip install uvicorn[standard]

$ server/pip install motor

After installing out virtual environment we have to source it, following the packages we are gonna be using. Uvicorn is used to run the server and motor is our async driver for mongoDB. After we are done with the installations it’s finally time for writing some code. Create a main.py file and for now put this in:

After that run $ uvicorn main:app — reload to run our server, you can open it on localhost:8001. Go to /docs to see the interactive api documentation.

Interactive api documentation

In our main.py we are going to specify our routes, we’ll build a CRUD server so we have to implement the following options: GET, POST, PUT, DELETE. We can remove the get(“/”) route and insert the ones we are going to use.

We’ll leave that as it is for now and come back later to it, now let’s define our model. Create a model.py file and do the following.

After we have defined our model, now we can start doing operations on the database. The following operations should cover the routes we have defined in main.py. So now let’s create our database.py file where we will make our connection to the db and CRUD operations.

So here we have defined our five methods that we are going to use. Now with all of them defined we have to tweak our main.py and start using all these methods. Change your main.py to look something more like this.

Now our routes actually do something and communicate with our database, there is some exception handling but this is far from finished but for this tutorial it’s enough for you to get a hang of things. I invite you to fiddle with this and add or change some things, maybe even change the premise and instead of todo make a recipe or book model and make operations based on that. Add some checks as if an document exists, if it exists don’t add a new one and send a corresponding message to that event. There are many improvements that you can make and I invite you to do them before advancing further down this article, for the purposes of this article it is enough and we’ll go and implement the client side now.
Node Mongo
By: Aslam Hossain
Tags: Nodejs, Mongodb

Currently I’m working with M E R N stack. I love to learn new technology and explore them. I’m a simply simple person with lots of interests.
Flutter File upload using Multer,Node.js and MongoDB.
By: Himanshu Ranjan
Tags: Flutter, Nodejs, iOS, Android, Mongodb

Today we are going to talk about how we can integrate flutter with a node.js and MongoDB backend to store images on the server with the help of popular node.js package “Multer”.

What really is Multer?

Multer is a node.js middleware for handling multipart/form-data , which is primarily used for uploading files. It is written on top of busboy for maximum efficiency.You can read the documentation here:

In this session,we are going to make a simple flutter app to pick image from the phone’s gallery and send it over the server and save it for later use using multer and MongoDB.

Let’s get started.

First of all make a node.js folder using npm init and make a server.js file.

and make a server.js file. Let’s install the npm packages that we need for this project using the given command:

npm install express mongoose nodemon multer

Import all the packages in your server file.

const express= require('express')

const multer=require('multer')

const path= require('path')

const app= express();

const mongoose= require('mongoose')

const model = require('./model') app.get('/',(req, res) => {

res.send('We are at home')

});

Configure your multer storage parameters that includes which folder you would like to set for saving the incoming images and the name of the images to be set.

var storage = multer.diskStorage({

destination: function (req, file, cb) {

cb(null, 'uploads')

},



filename: function (req, file, cb) {

cb(null, new Date().toISOString()+file.originalname

)

}

})

Let’s set up our routes now to serve the incoming requests.

app.post('/upload', upload.single('myFile'), async(req, res, next) => { const file = req.file

if (!file) {

const error = new Error('Please upload a file') error.httpStatusCode = 400

return next("hey error")

}

const imagepost= new model({

image: file.path

})



const savedimage= await imagepost.save()

res.json(savedimage)

}) app.get('/image',async(req, res)=>{

const image = await model.find()

res.json(image)

})

After setting up the routes,let’s connect our server to mongoDB using mongoose package.

mongoose.connect(YOUR_MONGODB_URL,{ useNewUrlParser: true },()=>{ console.log('db connnected')}) app.listen(3000);

We will be creating the collection model now which is already been used in the routes.

Here’s the complete server.js code:

Let’s create our model now that will help us upload image url’s in MongoDB.

Make sure you make your uploads(The folder where all the incoming images will be saved) folder which is in the same folder as that of your node folder is statically available to your server.js code using this:

app.use('/uploads', express.static(__dirname +'/uploads'));

We’re done with the backend part now,Let’s make our frontend using flutter.

In the above code, we are picking up a image using image picker then reading the image as a bytes stream and later posting it to our node.js server using Multipart Form request.

Note: Make sure your use the same image name that you used in your node.js server i.e myFile here.
MongoDB: Collection Relationships
By: Johnson Kow
Tags: Software Development, Software Engineering, Backend Development, Mongodb

Welcome!

I’m currently in the process of doing everything that I know how to do with different technologies. My experience with backend development is in Ruby on Rails using postgreSQL Now, I’m working with MongoDB and NodeJS.

I’ve been thinking about making an app that I’ve had in mind for a while and make it the number one project on my portfolio so I started at the drawing board. Then I realized, how do I make my models with relationships like one-to-many or one-to-one? The mongodb docs goes into an incredibly simple solution called embedding. This isn’t THE solution for most applications but for a small one like this one, it is.

R e l a t i o n s h i p s

one-to-one

For this simple example, lets say that we have a one-to-one relationship between a user and an address. In simple terms, every user has an address and every address has a user.

//User

{

_id: 'Joe',

name: 'Joey Codesalot'

} //Address

{

user_id: 'Joe',

street: '123 Fake Street',

city: 'Fake City

state: 'NY'

zip: 12345

}

In a relational database, you’d give the unique identifier to the address to associate it to the user who lives in it. Using MongoDb, you can just embed this information into the user’s instance as such.

{

_id:'Joe',

name:'Joe Codesalot',

address:{

street: "123 Fake Street"

city: "Fake City"

state: "NY"

zip: 12345

}

}

one-to-many

Now for one-to-many, you can already guess what it’s look like once it’s been embedded. Traditionally in relational databases it will look as such.

//User

{

_id:'Joe',

name: 'Joey Codesalot'

} //Address 1

{

user_id:'Joe',

street: "123 Fake Street"

city: "Fake City"

state: "NY"

zip: 12345

} //Address 2

{

user_id:'Joe',

street: "1 Other Street"

city: "Boston"

state: "MA"

zip: 54321

}

Embedding this information to the user will just create an attribute of key ‘addresses’ with a value of an array of objects [{},{}]. Let’s look at it below.

{

_id:'Joe',

name: 'Joey Codesalot',

address: [{



street: "123 Fake Street"

city: "Fake City"

state: "NY"

zip: 12345

},

{

street:"1 Other Street"

city: "Boston"

state: "MA"

zip: 54321

}]

}

There you have it! That’s how you build out the relationships inside of your database. The biggest caveat to this is that with more information, the bigger the instance and the slower the query. Personally, this will get the job done for me as I build out this small application.

With that said, I hope everyone has a wonderful week! Happy holidays and enjoy the coding journey !
How to create models and schemas for the API endpoints with Mongoose
By: Orly Knop
Tags: Js, Nodejs, API, Mongodb

In this article, we will create models and schemas for the Author and Book objects that we need for API endpoints.

Photo by Glenn Carstens-Peters on Unsplash

Models

Run this command to install mongoose:

npm i mongoose

Let’s create a schema and a model for the object author. The authors should have first and last names, biography, dates of birth, and death (optional). Create a new file authors.js in this location src/services/authors/models/ and paste this code into it:

In this file, we create the schema. We specify types and if the property is required or not. Then we use this schema to create a model named AuthorModel .

We set dateOfBirth and dateOfDeath to have type Date and as a result, it will have a timestamp. We also want to store the exact dates users will input (the date should not be dependent on any timezone). So, before saving a new Author object, we will convert both dates, set values for hours, minutes, and seconds to be 0. We will do that in a pre-save hook.

Add this code before the last line where we create the author model:

Pre-save hook for author schema

The code inside pre-save hook is run after validation so we can be sure that the dates are valid when we prepare the data for saving. The dateOfBirth is required so we can freely do new Date(this.dateOfBirth) but dateOfDeath is not required so we call getUTCDateNoTime only when it is not undefined .

Now we will create the book model. Create a new file src/services/books/models/books.js with this content:

Books will have a title, description, and author id, which references the AuthorModel we previously created. Title and reference to the author should be required. We also create an index for the authorId property.

Summary

In this article, we have created schemas and models for two objects with required properties, created an index, and made one property to be a reference to another model. We also added pre-save hook to our model to do the changes to the provided data before saving it to the database.

This is the second part of the “How to develop API with Node.js and Express” series. If you want to follow along read the previous article where we set up the project. The whole project is on GitHub.
Getting Started with mongoDB
By: Muhammad Zain Tariq
Tags: Nosql Database, Mern, Mongodb

Step by Step guide to install mongoDB on window’s

mongoDB

In this Blog, You will Learn

What is mongoDB?

Setup and installation of mongoDB.

What is mongoDB?

MongoDB is a document database with the scalability and flexibility that you want with the querying and indexing. It is a schema less or NoSQL database. NoSQL database means that we can store different documents having different schema inside a same collection.

Difference in SQL database and mongoDB is that sql tables are called collections in mongoDB and records in sql is called documents

Setup and installation of mongoDB.

For installing mongoDB we will follow the following steps

Step 1.

first move to mongoDB where we will select Software->Community Server as shown in figure 1.

figure 1.

Step 2.

After redirecting to community server page will select our version for mongoDB(mongoDB 4.4 and onward will only work for windows 10) and platform after this press Download button as shown in figure 2.

figure 2.

Step 3.

Now .msi file will download and press that file for installing Process.

Press Next as shown in figure 3.

figure 3.

Step 4.

Now checked the box for accepting agreement terms and Press Next. as shown in figure 4.

figure 4.

Step 5.

Now Press Complete as shown in figure 5.

figure 5.

Step 6.

Again Press Next and checked the box for installing MongoDB Compass as shown in figure 6.

figure 6.

Step 7.

Press Install

Press Finish and Hurry mongoDB is installed now for confirming that installation is Completed successfully we will following steps.

Step 8.

Create a path variable in environement

first we will create a path variable in environment For this, search Environment variable in your pc and set path as following:

C:\Program Files\MongoDB\Server\4.0\bin

for this open control panel->System security->System->Advanced System settings and than select environment variable as shown below

now we will select NEw option a box will appear enter variable name as PATH and this path C:\Program Files\MongoDB\Server\4.0\bin as variable value as shown in figure.