Skip to content
This repository has been archived by the owner on Mar 24, 2024. It is now read-only.

Commit

Permalink
Merge branch 'master' into v1.3.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco5dev committed Oct 2, 2023
2 parents eaa2778 + 95dea73 commit 54a2ed7
Show file tree
Hide file tree
Showing 57 changed files with 3,027 additions and 234 deletions.
468 changes: 234 additions & 234 deletions README.md

Large diffs are not rendered by default.

23 changes: 23 additions & 0 deletions content/docs/1.3.2/API Reference/Jsonverse Class/Constructor.md
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.
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 content/docs/1.3.2/API Reference/Jsonverse Class/_index.md
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 content/docs/1.3.2/API Reference/Jsonverse Class/model() Method.md
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 content/docs/1.3.2/API Reference/Model Class/Constructor.md
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.
10 changes: 10 additions & 0 deletions content/docs/1.3.2/API Reference/Model Class/_index.md
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 content/docs/1.3.2/API Reference/Model Class/delete() Method.md
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 content/docs/1.3.2/API Reference/Model Class/find() Method.md
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 content/docs/1.3.2/API Reference/Model Class/save() Method.md
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 content/docs/1.3.2/API Reference/Model Class/update() Method.md
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.
10 changes: 10 additions & 0 deletions content/docs/1.3.2/API Reference/_index.md
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 content/docs/1.3.2/Backup and Restore/Cleaning Up Old Backups.md
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.
Loading

0 comments on commit 54a2ed7

Please sign in to comment.