All Projects → alcoholiclobster → fivem-mongodb

alcoholiclobster / fivem-mongodb

Licence: MIT license
MongoDB wrapper for FiveM

Programming Languages

javascript
184084 projects - #8 most used programming language
lua
6591 projects

Projects that are alternatives of or similar to fivem-mongodb

Re-Ignited-Phone
ReIgnited Phone is a continuation and reimagination of the original GCPhone resource
Stars: ✭ 55 (+120%)
Mutual labels:  fivem
FiveM-Paid-Anticheats
Fivem Anticheat's sources, cracks and other shit have fun with it. Remember API > ALL https://discord.gg/stz4nCkhZp
Stars: ✭ 35 (+40%)
Mutual labels:  fivem
Tezos-Developer-Resources
Resources for Tezos Developers
Stars: ✭ 34 (+36%)
Mutual labels:  resource
pma-voice
An easy drag n' drop resource that gives you a wrapper to use FiveM's built-in mumble voice.
Stars: ✭ 160 (+540%)
Mutual labels:  fivem
esx scoreboard
esx - scoreboard | A user friendly scoreboard for your server ;)
Stars: ✭ 28 (+12%)
Mutual labels:  fivem
open-electronics
📚 💻 Great Resources for Electronics Enthusiasts
Stars: ✭ 347 (+1288%)
Mutual labels:  resource
routing
Aplus Framework Routing Library
Stars: ✭ 186 (+644%)
Mutual labels:  resource
Loadables
A Unity3D library for abstracting and simplifying loadable assets and scenes.
Stars: ✭ 23 (-8%)
Mutual labels:  resource
CatAsset
Unity资源管理框架
Stars: ✭ 130 (+420%)
Mutual labels:  resource
AppThinning
Make app thinner. Help you find large files and compress png, gif, jpg, svg files. 应用程序瘦身工具,帮助你找到大文件,压缩png、gif、jpg、svg等文件。
Stars: ✭ 22 (-12%)
Mutual labels:  resource
objection-authorize
isomorphic, "magical" authorization integration with Objection.js 🎉
Stars: ✭ 71 (+184%)
Mutual labels:  resource
ResourcesPoet
Kotlin API for generating Android XML Resources
Stars: ✭ 102 (+308%)
Mutual labels:  resource
PolyZone
PolyZone is a FiveM mod to define zones of different shapes and test whether a point is inside or outside of the zone
Stars: ✭ 136 (+444%)
Mutual labels:  fivem
gb banking
FiveM Extended Banking Script
Stars: ✭ 14 (-44%)
Mutual labels:  fivem
esx repairkit
Simple repairkit script for FiveM ESX servers
Stars: ✭ 36 (+44%)
Mutual labels:  fivem
menuv
FiveM menu library for creating menu's with NUI
Stars: ✭ 85 (+240%)
Mutual labels:  fivem
Innovative-Book-Resources
This repository contains books from different topics and perfect enough to give developers a boost in understanding the concepts of Data Science and Artificial Intelligence(other topics are also included but main highlights are these two).
Stars: ✭ 57 (+128%)
Mutual labels:  resource
FiveM-Bot
[OUTDATED] Monitor your FiveM (GTA Online) Server with FiveM Bot.
Stars: ✭ 27 (+8%)
Mutual labels:  fivem
esx extraitems
Extra Items for FiveM ESX Legacy
Stars: ✭ 44 (+76%)
Mutual labels:  fivem
getting-started
✨ START HERE ✨ Introduction to the club with a bunch of useful links!
Stars: ✭ 17 (-32%)
Mutual labels:  resource

FiveM MongoDB wrapper

Description

This resource is a simple MongoDB wrapper for FiveM. It's running on top of MongoDB Node Driver.

Installation

  1. Clone this repository to resources/mongodb folder.
  2. Copy mongodb/database.cfg to your server root directory.
  3. Add the following lines to your server config:
exec "database.cfg"
start mongodb
  1. Change mongodb_url and mongodb_database in database.cfg.
  2. Run npm install in resources/mongodb directory.

Usage

Every callback accepts success<boolean> as its first argument. If success is false, second argument contains error message.

Example (Lua):

exports.mongodb:findOne({ collection = "users", query = { _id = id } }, function (success, result)
    if not success then
        print("Error message: "..tostring(result))
        return
    end

    print("User name is "..tostring(result[1].name))
end)

exports.mongodb.isConnected

  • Returns boolean

Returns true if database connection is established.

exports.mongodb.insert(params, callback);

  • params<Object> - params object
  • params.collection<string> - collection name
  • params.documents<Object> - an array of documents to insert
  • params.options<Object> - optional settings object. See collection.insertMany in docs
  • callback(success<boolean>, insertedCount<number>, insertedIds<Array>) - callback (optional) Inserts an array of documents into MongoDB.

exports.mongodb.insertOne(params, callback);

  • params<Object> - params object
  • params.collection<string> - collection name
  • params.document<Object> - document object
  • params.options<Object> - optional settings object. See collection.insertMany in docs
  • callback(success<boolean>, insertedCount<number>, insertedIds<Array>) - callback (optional)

Inserts a single document into MongoDB.

exports.mongodb.find(params, callback);

  • params<Object> - params object
  • params.collection<string> - collection name
  • params.query<Object> - filter query object
  • params.options<Object> - optional settings object. See collection.find in docs
  • params.limit<number> - limit documents count
  • callback(success<boolean>, documents<Array>) - callback (optional)

Performs a find query.

exports.mongodb.findOne(params, callback);

  • params<Object> - params object
  • params.collection<string> - collection name
  • params.query<Object> - filter query object
  • params.options<Object> - optional settings object. See collection.find in docs
  • callback(success<boolean>, documents<Array>) - callback (optional)

Performns a find query with limit = 1.

exports.mongodb.update(params, callback);

  • params<Object> - params object
  • params.collection<string> - collection name
  • params.query<Object> - filter query object
  • params.update<Object> - update query object
  • params.options<Object> - optional settings object. See collection.updateMany in docs
  • callback(success<boolean>, updatedCount<number>) - callback (optional)

Update multiple documents on MongoDB.

exports.mongodb.updateOne(params, callback);

  • params<Object> - params object
  • params.collection<string> - collection name
  • params.query<Object> - filter query object
  • params.update<Object> - update query object
  • params.options<Object> - optional settings object. See collection.updateMany in docs
  • callback(success<boolean>, updatedCount<number>) - callback (optional)

Update a single document on MongoDB.

exports.mongodb.count(params, callback);

  • params<Object> - params object
  • params.collection<string> - collection name
  • params.query<Object> - filter query object
  • params.options<Object> - optional settings object. See collection.countDocuments in docs
  • callback(success<boolean>, count<number>) - callback (optional)

Gets the number of documents matching the filter.

exports.mongodb.delete(params, callback);

  • params<Object> - params object
  • params.collection<string> - collection name
  • params.query<Object> - filter query object
  • params.options<Object> - optional settings object. See collection.deleteMany in docs
  • callback(success<boolean>, deletedCount<number>) - callback (optional)

Delete multiple documents on MongoDB.

exports.mongodb.deleteOne(params, callback);

  • params<Object> - params object
  • params.collection<string> - collection name
  • params.query<Object> - filter query object
  • params.options<Object> - optional settings object. See collection.deleteMany in docs
  • callback(success<boolean>, deletedCount<number>) - callback (optional)

Delete a document on MongoDB.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].