CodeWithHarry / iNotebook-React

INotebook is a React Application for managing personal notes on the cloud

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Asking for Help

sanchyanchakraborty opened this issue · comments

Hi Harry Vaiyaa,

There is no issue with your code. Your tutorials are really nice and helpful for us. It's difficult to communicate with you in Youtube, that's why I wrote in github
I'm asking for a help that, I checked about nodejs dateTime thing,
It's
var d1 = new Date();
//creates a 32Bit DateTime of Unix Time Stamp
Where Unix Time Stamp will expire January 19, 2038, at 3:14 a.m. Due to 32Bit fully binaries are used.
I checked lot, can't find 64Bit DateTime Object for nodejs, where as I can find 64Bit Date Time Object in PHP laravel.

Please guide it. And Thanks in Advance for the beautiful tutorials.

Another thing, you described schemas for DB operations.
But in laravel and nodejs I'm using these functions for DB operations without any schemas.
Please check out these function and share your thoughts about this functions.

async function getData(collectionName, query) {
    collection = database.collection(collectionName);
    const cursor = collection.find(query);
    const allValues = await cursor.toArray();
    return allValues;
}

async function insertOneData(collectionName, data) {
    collection = database.collection(collectionName);
    const result = await collection.insertOne(data);
    return result;
}

async function updateOneData(collectionName, where, data) {
    // this option instructs the method to create a document if no documents match the filter
    const options = { upsert: true };
    const updateDoc = {
        $set: data
    };
    collection = database.collection(collectionName);
    const result = await collection.updateOne(where, updateDoc, options);
    return result;
}


async function replaceOneData(collectionName, where, data) {
    // This Method will replace the dictionay, be careful to using of it. 
    // this option instructs the method to create a document if no documents match the filter
    const options = { upsert: true };
    collection = database.collection(collectionName);
    const result = await collection.replaceOne(where, data, options);
    return result;
}

async function deleteOneData(collectionName, where) {
    collection = database.collection(collectionName);
    const result = await collection.deleteOne(where);
    return result;
}
app.post("/insert", async (request, response) => {
    const query = { email: request.body.email };
    const allValues = await insertOneData(user, query);
    response.send(allValues);

});

SAME ISSUE XD CONTACT @CodeWithHarry