aloshai / mongosha Goto Github PK
View Code? Open in Web Editor NEWA fast, optimized and easy-to-use database manager. MongoDB has never been easier! Perfect for beginners!
Home Page: https://www.npmjs.com/package/mongosha
License: MIT License
A fast, optimized and easy-to-use database manager. MongoDB has never been easier! Perfect for beginners!
Home Page: https://www.npmjs.com/package/mongosha
License: MIT License
Concatenating data inside an array
Let's make our own custom settings :>
A function that can make our work easier should come to the module. (await db.update
) It will be able to change the content in any "set" data or "push" data. For example, let's register our data as follows.
await db.set(`hollowking.${message.guild.id}`, {
Name: "Sude Magda",
Surname: "ALACATI",
Points: 15
})
>
hollowking: {
"795019981493895168": {
Name: "Sude Magda",
Surname: "ALACATI",
Points: 15
}
}
But our grumpy daughter Magda doesn't seem to like her point. As her caregiver, we have to fix this problem. For this, we need to change the record in a data.
await db.update(`hollowking.${message.guild.id}`, {
change: {
Surname: "Wiśniewski"
},
add: {
Points: +5
},
remove: {
Name: "Sude"
},
create: {
Voivodeship: "Warsaw"
}
})
>
hollowking: {
"795019981493895168": {
Name: "Magda",
Surname: "Wiśniewski",
Points: 20,
Voivodeship: "Warsaw"
}
}
Our grumpy daughter now has 20 points. We have to make a little more change before seeing the very rich father. A list of must-come is listed below.
Change:
It changes a data. If used in terms of number, it directly changes the place of the newly entered number without adding or subtracting.
Add:
It is used on all types of data. If used on a number, it adds to the number's value. (Of course at the beginning of the number - if any, this is different.) If used on a string value, it performs direct concatenation. (Before: Date, After: Datesing. Adding Date String value to + "sing")
Decrease:
It does the subtraction in the same way
Create:
It creates a separate data. Although unnecessary for "set" type data, it is very useful for "push" data.
Remove:
It deletes a seperate data. Although unnecessary for "set" type data, it is very useful for "push" data.
There will be a value for each push. That is, first data, second data and third data under "push". These data will of course start from 0. The numbers of these data will be processed. For example, there are 15 pushed data under a database. We will have 15 numbers with a starting record from 0.
await db.update(`melcorn.${message.guild.name}[0]`, {
change: (...)
})
Everything can be very complicated, but I am sure she will bring many changes behind her. "Plus why don't we create a separate record for each data and add or subtract from it more easily?" The best answer to the question may be speed and convenience. At the same time, keeping less data and gathering all data under one roof is an adequate answer.
With love!
completely removing an element / data inside the array
const result = collection.get("user"); // => [{ "id": 1, "balance": 3 }, { "id": 2, "balance": 300 }, { "id": 13 "balance": 400 }]
const result = collection.get("user.balance"); // => [3, 300, 400];
const result = collection.get("user.balance", "user.id"); // => [{ "id": 1, "balance": 3 }, { "id": 2, "balance": 300 }, { "id": 13 "balance": 400 }]
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.