This repository has been archived by the owner on Mar 24, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
57 changed files
with
3,027 additions
and
234 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
content/docs/1.3.2/API Reference/Jsonverse Class/Constructor.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
--- | ||
title: "Constructor" | ||
description: "The constructor initializes a jsonverse instance with optional configuration options." | ||
summary: "The constructor initializes a jsonverse instance with optional configuration options." | ||
date: 2023-09-18T13:21:36+03:00 | ||
lastmod: 2023-09-18T13:21:36+03:00 | ||
draft: false | ||
images: [] | ||
menu: | ||
docs: | ||
parent: "" | ||
identifier: "Constructor-98963dda527029a968bc906044c1746a" | ||
weight: 120 | ||
toc: true | ||
--- | ||
|
||
The constructor initializes a jsonverse instance with optional configuration options. | ||
|
||
```javascript | ||
const jsonverse = new jsonverse(options); | ||
``` | ||
|
||
Use this constructor to create a jsonverse instance with custom configuration options if needed. |
37 changes: 37 additions & 0 deletions
37
content/docs/1.3.2/API Reference/Jsonverse Class/Logging Methods.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--- | ||
title: "Logging Methods" | ||
description: "The `jsonverse` class provides methods for logging messages to both the console and log files." | ||
summary: "The `jsonverse` class provides methods for logging messages to both the console and log files." | ||
date: 2023-09-18T13:22:56+03:00 | ||
lastmod: 2023-09-18T13:22:56+03:00 | ||
draft: false | ||
images: [] | ||
menu: | ||
docs: | ||
parent: "" | ||
identifier: "Logging Methods-fe78668ccb557c4fe42c20a3358ab1b8" | ||
weight: 140 | ||
toc: true | ||
--- | ||
|
||
The `jsonverse` class provides methods for logging messages to both the console and log files. | ||
|
||
## logToConsoleAndFile(message) Method | ||
|
||
The `logToConsoleAndFile(message)` method logs a message to both the console and the log file. | ||
|
||
```javascript | ||
jsonverse.logToConsoleAndFile('This is a log message.'); | ||
``` | ||
|
||
Use this method to log messages that should be displayed in the console and recorded in a log file. | ||
|
||
## logError(message) Method | ||
|
||
The `logError(message)` method logs an error message to both the console and the log file. | ||
|
||
```javascript | ||
jsonverse.logError('This is an error message.'); | ||
``` | ||
|
||
Use this method to log and handle errors within your jsonverse application. |
10 changes: 10 additions & 0 deletions
10
content/docs/1.3.2/API Reference/Jsonverse Class/_index.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
title: "Jsonverse Class" | ||
description: "" | ||
summary: "" | ||
date: 2023-09-18T13:20:55+03:00 | ||
lastmod: 2023-09-18T13:20:55+03:00 | ||
draft: false | ||
images: [] | ||
weight: 110 | ||
--- |
51 changes: 51 additions & 0 deletions
51
content/docs/1.3.2/API Reference/Jsonverse Class/model() Method.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
--- | ||
title: "Model() Method" | ||
description: "The `model()` method creates and returns a model instance for defining and interacting with data models." | ||
summary: "The `model()` method creates and returns a model instance for defining and interacting with data models." | ||
date: 2023-09-18T13:22:47+03:00 | ||
lastmod: 2023-09-18T13:22:47+03:00 | ||
draft: false | ||
images: [] | ||
menu: | ||
docs: | ||
parent: "" | ||
identifier: "model() Method-bcb72a438a345fab613f8287dde75ce9" | ||
weight: 130 | ||
toc: true | ||
beta: true | ||
--- | ||
|
||
The `model()` method creates and returns a model instance for defining and interacting with data models. | ||
|
||
```javascript | ||
const modelName = 'MyModel'; | ||
const schemaDefinition = { /* Schema definition goes here */ }; | ||
const myModel = jsonverse.model(modelName, schemaDefinition); | ||
``` | ||
or | ||
```javascript | ||
const Jsonverse = require("jsonverse"); | ||
const db = new Jsonverse(); | ||
|
||
const { Schema } = Jsonverse; | ||
|
||
const userSchema = new Schema({ | ||
name: { | ||
type: String, | ||
required: true, | ||
}, | ||
age: { | ||
type: Number, | ||
required: true, | ||
}, | ||
email: { | ||
type: String, | ||
required: true, | ||
unique: true, | ||
}, | ||
}); | ||
|
||
module.exports = db.model("User", userSchema); | ||
``` | ||
|
||
Use this method to create and configure data models within the jsonverse instance. |
26 changes: 26 additions & 0 deletions
26
content/docs/1.3.2/API Reference/Model Class/Constructor.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- | ||
title: "Constructor" | ||
description: "The constructor initializes a `Model` instance with the specified data name and schema definition." | ||
summary: "The constructor initializes a `Model` instance with the specified data name and schema definition." | ||
date: 2023-09-18T13:21:43+03:00 | ||
lastmod: 2023-09-18T13:21:43+03:00 | ||
draft: false | ||
images: [] | ||
menu: | ||
docs: | ||
parent: "" | ||
identifier: "Constructor-98c524aa263d84d9c0010b6477669a99" | ||
weight: 160 | ||
toc: true | ||
beta: true | ||
--- | ||
|
||
The constructor initializes a `Model` instance with the specified data name and schema definition. | ||
|
||
```javascript | ||
const dataName = 'MyModel'; | ||
const schemaDefinition = { /* Schema definition goes here */ }; | ||
const myModel = new Model(dataName, schemaDefinition); | ||
``` | ||
|
||
Use this constructor to create a `Model` instance for defining and interacting with data models within the `jsonverse` instance. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
title: "Model Class" | ||
description: "" | ||
summary: "" | ||
date: 2023-09-18T13:21:03+03:00 | ||
lastmod: 2023-09-18T13:21:03+03:00 | ||
draft: false | ||
images: [] | ||
weight: 150 | ||
--- |
30 changes: 30 additions & 0 deletions
30
content/docs/1.3.2/API Reference/Model Class/delete() Method.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
--- | ||
title: "Delete() Method" | ||
description: "The `delete()` method allows you to delete data from the database using a `Model` instance." | ||
summary: "The `delete()` method allows you to delete data from the database using a `Model` instance." | ||
date: 2023-09-18T13:23:15+03:00 | ||
lastmod: 2023-09-18T13:23:15+03:00 | ||
draft: false | ||
images: [] | ||
menu: | ||
docs: | ||
parent: "" | ||
identifier: "delete() Method-487da9090ae1d34aec48a3bae10a8b5c" | ||
weight: 180 | ||
toc: true | ||
beta: true | ||
--- | ||
|
||
The `delete()` method allows you to delete data from the database using a `Model` instance. | ||
|
||
```javascript | ||
const query = { /* Query to specify which data to delete goes here */ }; | ||
try { | ||
await myModel.delete(query); | ||
// Data deleted successfully | ||
} catch (error) { | ||
// Handle any errors | ||
} | ||
``` | ||
|
||
Use this method to delete data from the database based on a specified query. |
32 changes: 32 additions & 0 deletions
32
content/docs/1.3.2/API Reference/Model Class/find() Method.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
--- | ||
title: "Find() Method" | ||
description: "The `find()` method allows you to search for data in the database using a `Model` instance." | ||
summary: "The `find()` method allows you to search for data in the database using a `Model` instance." | ||
date: 2023-09-18T13:23:33+03:00 | ||
lastmod: 2023-09-18T13:23:33+03:00 | ||
draft: false | ||
images: [] | ||
menu: | ||
docs: | ||
parent: "" | ||
identifier: "find() Method-57bb54b13b29dac68dcacc12c465221c" | ||
weight: 200 | ||
toc: true | ||
beta: true | ||
--- | ||
|
||
The `find()` method allows you to search for data in the database using a `Model` instance. | ||
|
||
```javascript | ||
const query = { /* Query to specify search criteria goes here */ }; | ||
try { | ||
const result = await myModel.find(query); | ||
// Process the search results | ||
} catch (error) { | ||
// Handle any errors | ||
} | ||
``` | ||
|
||
Use this method to search for and retrieve data from the database based on a specified query. | ||
|
||
The `result` variable will contain the search results that match the query. |
30 changes: 30 additions & 0 deletions
30
content/docs/1.3.2/API Reference/Model Class/save() Method.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
--- | ||
title: "Save() Method" | ||
description: "The `save()` method allows you to save data to the database using a `Model` instance." | ||
summary: "The `save()` method allows you to save data to the database using a `Model` instance." | ||
date: 2023-09-18T13:23:06+03:00 | ||
lastmod: 2023-09-18T13:23:06+03:00 | ||
draft: false | ||
images: [] | ||
menu: | ||
docs: | ||
parent: "" | ||
identifier: "save() Method-85fa0aaf8ac16b1318330df9bd1cc37b" | ||
weight: 170 | ||
toc: true | ||
beta: true | ||
--- | ||
|
||
The `save()` method allows you to save data to the database using a `Model` instance. | ||
|
||
```javascript | ||
const dataToSave = { /* Data to be saved goes here */ }; | ||
try { | ||
await myModel.save(dataToSave); | ||
// Data saved successfully | ||
} catch (error) { | ||
// Handle any errors | ||
} | ||
``` | ||
|
||
Use this method to save data according to the schema definition of the `Model`. |
31 changes: 31 additions & 0 deletions
31
content/docs/1.3.2/API Reference/Model Class/update() Method.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
--- | ||
title: "Update() Method" | ||
description: "The `update()` method allows you to update data in the database using a `Model` instance." | ||
summary: "The `update()` method allows you to update data in the database using a `Model` instance." | ||
date: 2023-09-18T13:23:24+03:00 | ||
lastmod: 2023-09-18T13:23:24+03:00 | ||
draft: false | ||
images: [] | ||
menu: | ||
docs: | ||
parent: "" | ||
identifier: "update() Method-353bca8f38b1ee5bc699b38ccf67ee68" | ||
weight: 190 | ||
toc: true | ||
beta: true | ||
--- | ||
|
||
The `update()` method allows you to update data in the database using a `Model` instance. | ||
|
||
```javascript | ||
const query = { /* Query to specify which data to update goes here */ }; | ||
const updates = { /* Data updates to apply go here */ }; | ||
try { | ||
await myModel.update(query, updates); | ||
// Data updated successfully | ||
} catch (error) { | ||
// Handle any errors | ||
} | ||
``` | ||
|
||
Use this method to update data in the database based on a specified query and set of updates. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
--- | ||
title: "API Reference" | ||
description: "" | ||
summary: "" | ||
date: 2023-09-18T13:27:58+03:00 | ||
lastmod: 2023-09-18T13:27:58+03:00 | ||
draft: false | ||
images: [] | ||
weight: 100 | ||
--- |
49 changes: 49 additions & 0 deletions
49
content/docs/1.3.2/Backup and Restore/Cleaning Up Old Backups.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
--- | ||
title: "Cleaning Up Old Backups" | ||
description: "Regularly cleaning up old backups is essential to manage storage space effectively. jsonverse provides a way to automate the process of removing outdated backup files." | ||
summary: "Regularly cleaning up old backups is essential to manage storage space effectively. jsonverse provides a way to automate the process of removing outdated backup files." | ||
date: 2023-09-18T15:08:33+03:00 | ||
lastmod: 2023-09-18T15:08:33+03:00 | ||
draft: false | ||
images: [] | ||
menu: | ||
docs: | ||
parent: "" | ||
identifier: "Cleaning Up Old Backups-a5cc9e0ec0b5b5480373875e2d1688c1" | ||
weight: 310 | ||
toc: true | ||
--- | ||
|
||
Regularly cleaning up old backups is essential to manage storage space effectively. jsonverse provides a way to automate the process of removing outdated backup files. | ||
|
||
## Deleting Old Backups | ||
|
||
To delete old backups that exceed a certain retention period, you can use the following code: | ||
|
||
```js | ||
const jsonverse = require("jsonverse"); | ||
|
||
// Replace "yourDataName" with the name of your data | ||
const dataName = "yourDataName"; | ||
|
||
// Replace "retentionDays" with the number of days to retain backups | ||
const retentionDays = 30; // Adjust as needed | ||
|
||
jsonverse.backupDelete(dataName, retentionDays) | ||
.then(() => { | ||
console.log(`Old backups deleted for ${dataName}`); | ||
}) | ||
.catch((error) => { | ||
console.error("Error deleting old backups:", error); | ||
}); | ||
``` | ||
|
||
In this code, replace "yourDataName" with the actual name of your data, and set the "retentionDays" variable to the number of days you want to retain backups. Backups older than this retention period will be deleted automatically. | ||
|
||
It's essential to strike a balance between retaining enough backups for data recovery and not consuming excessive storage space. Adjust the "retentionDays" value according to your storage requirements and data backup strategy. | ||
|
||
## Backup Cleanup Schedule | ||
|
||
You can schedule the backup cleanup process to run at specific intervals, such as daily or weekly, to ensure that old backups are regularly removed and storage space is efficiently managed. Consider using a cron job or a scheduled task, depending on your operating system, to automate this cleanup process. | ||
|
||
Remember that cleaning up old backups helps keep your storage organized and avoids unnecessary data clutter. |
Oops, something went wrong.