Fuc* Db is an open source NoSQL json object Database written in rust.
- Native horizontal and vertical scaling.
- Fast Pre Compiled Query System
- Super fast read and write
- Open source alternative to Firebase Firestore
- Multi doc insert and delete functions.
- Queries can now be fetched in sections by limiting docs.
- Delete Collection from a single request.
download the built directory and run the windows executable and you have your db.
Fuc Db use a simple rest api to interface which can be queried with http post request.
put the windows executable in the folder where you want the db to be built and post the following json to initiate your db.
Url : http://localhost:3000/init
{
base:'rabdombasestring'
}
{
result:true,
error:null,
docs:{
key:'sd897sdf897sd89f7sd98f7sd98f7sd89f789sdf'
},
message:null
}
this base key value pair should be a random string and will be used to produce a admin key to the db.
the following queries can be used to manage user accounts.
the user account can be granted priveledges to submit and remove the files from the database.
Url : http://localhost:3000/user/register
{
key:'generated key',
user:'userNameString',
password:'userPasswordString'
}
{
result:true,
error:null,
docs:null,
message:null
}
the user account can be reset by the following request
Url : http://localhost:3000/user/reset
{
key:'generated key',
user:'registeredUserNameString',
password:'newUserPasswordString'
}
{
result:true,
error:null,
docs:null,
message:null
}
Deleting the user account if you want to.
Url : http://localhost:3000/user/delete
{
key:'generated key',
user:'registeredUserNameString'
}
{
result:true,
error:null,
docs:null,
message:null
}
session is required to start transaction in the database,session dont have a time limit and can be ended when a new session is started. session is recognised by a token limited to a single ip.This token have to be stored locally to transact with the db.
Url : http://localhost:3000/user/connect
{
user:'registeredUserNameString',
password:'userPasswordString'
}
{
result:true,
error:null,
docs:{
user:'akku',
token:'89a7s89sa7d89as7d89as7das89d7'
},
message:null
}
Multiple Json objets can be inserted, 100 at a time. wait for the previous query to complete before making another query.
Url : http://localhost:3000/insert
{
user:'usernameString',
token:'generatedToken',
address:'collectionAddressString',
docs:[{
something:'special'
}]
}
{
result:true,
error:null,
docs:null,
message:null
}
before running a query an index is needed to be made. Fuc use a precompiled data structure to provide fast and scalable query system.
query includes 3 components equal,weight,order and search. with data type attached.
this string cantains the key of the key value pair in json object as the first argument, followed by data type and seprated by a "." and the function
this function make a index to do >= <= functions with numbers, the first argument is the key followed by the data type and the query function. this function can only be called on keys with data type of a number.
this function is similar to the above two.
this function is called by the key followed by the direction of which the data is listed in the database. valid directions are asc and desc.This function is seprated by "_" in the query string.
weight,search and equal function are sepereated by "||" and the order function is to be placed at the end of the query seperated by "_".
multiple functions can be combined to make a desired index but only one of dynamic function is allowed in the query. this means that either one of search,order or weight can be used with multiple equal tags.
Url : http://localhost:3000/query/register
{
user:'akku',
token:'ds89f7sd89f7sd89f7sd89f7s89df',
query:'name.string.equal||mobile.number.equal_regDate.asc',
address:'collectionAddress'
}
{
result:true,
error:null,
docs:null,
message:null
}
queries can be used to find data in the db with minimum cost by the following request.
{
user:'akku',
token:'ds89f7sd89f7sd89f7sd89f7s89df',
query:'name.string.equal||mobile.number.equal_regDate.asc',
address:'collectionAddress',
params:{
name:'akku',
mobile:91100110011,
regDate:5645678453468464,
dir:'asc',
limit:25,
last:'dsa7fds7f6sd7f868'
}
}
{
result:true,
error:null,
docs:['098sdf9sd8f88dfd','sd09f8sd90f8ds908f'],
message:null
}
this api returns the doc address which can be fetched afterwards.
params document containes the key value pair of the search tag and value with direction (dir) => asc or desc, limit is the number of documents you want to query and last is the last name value from the doc from previous query.
this query returns a array of json objects by document Id.manimum of 50 docs can be fetched at once. multiple fetch queries can be called at once depends on your storage read speed.
url : http://localhost:3000/get/docs
{
user:'akku',
token:'ds89f7sd89f7sd89f7sd89f7s89df',
address:'collectionAddress',
docs:['sd789sdf8sd8f','sdfsdfsdf890']
}
{
result:true,
error:null,
docs:[{doc:1},{doc:2}],
message:null
}
this query returns doc id of all the docs in a collection which can be listed by using control params of direction(dir), limit and last.multiple queries can be called at once.if you wanna get all the docs just dont use the params.
{
user:'akku',
token:'ds89f7sd89f7sd89f7sd89f7s89df',
address:'collectionAddress'
}
{
result:true,
error:null,
docs:['sd789sdf8sd8f','sdfsdfsdf890'],
message:null
}
these doc ids can be canverted to docs using get docs query.
this query takes doc id and data and update the previous doc and its indexes, only one doc can be update in a single query 100 unique queries can be called at once.this function returns the new doc id.
{
user:'akku',
token:'ds89f7sd89f7sd89f7sd89f7s89df',
address:'collectionAddress',
id:'sdaf78dsf798sd7f8s89s897987',
doc:{
name:'doku',
mobile:9119119119
}
}
{
result:true,
error:null,
docs:{new_id:'sdf786sd7f667678sd6f78sd6fdfdf'}
message:null
}
this query takes a array of doc ids and deletes em all at max 100 docs can be deleted at once dont make more then 50 simutanious request at once well this depends on your io speeds.
{
user:'akku',
token:'ds89f7sd89f7sd89f7sd89f7s89df',
address:'collectionAddress',
docs:['sd789sdf8sd8f','sdfsdfsdf890']
}
{
result:true,
error:null,
docs:null
message:null
}
this query takes a collection address and deletes all the data inside of it including child components for this query you have to provide admin privileges to the app on your os.At max 10 simultanious queries can be made.
{
user:'akku',
token:'ds89f7sd89f7sd89f7sd89f7s89df',
address:'collectionAddress',
}
{
result:true,
error:null,
docs:null
message:null
}
MIT
**You be free Hackers **
fuc* by Akku