Giter Site home page Giter Site logo

xenus's Introduction

Xenus is a simple and elegent MongoDB ODM.

  • It has built-in and cross framework support for events (Doc)
  • It makes your schema self documented via document's mutators (Doc)
  • It includes fluent methods to update, delete and insert documents (Doc)
  • It supports documents' embeding via an elegent syntax (Doc)
  • It handles relationships out of the box (Doc)
  • It provides an elegent transformation layer mechanism for your API resources (Doc)

If you're working with the Laravel or Lumen framework, take a look at the Xenus Laravel integration.

Learning Xenus

The documentation is available at https://abellion.github.io/xenus

License

Xenus is licensed under the MIT license.

xenus's People

Contributors

abellion avatar jeto143 avatar kcalliauw avatar mitrii avatar mkade avatar opeadeyomoye avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

xenus's Issues

Is possible to set a whitelist in a Document

Hello,

I'm using the Xenus lib in a CakePHP project. I could implement it with no problems. It was very easy to install on it.

Since I started to use I'm trying to find out the best way to "Map" the document.
I read the full documentation on https://abellion.github.io/xenus/ but I could not find if it is possible.

E.g.: I want the logs document only receive the "datetime" and "message" properties. Is it possible?

Thank you

About Relationships Documentation

Hello. I am confuse with Relationships Documentation. I am testing all I can.. but i don't get what I want.
Example: I am using a mongo atlas sandbox cluster which creates _id field on the roll. So I create Document Classes with
protected $withId = false; attribute.
Later I have ONE - TO - MANY relationship, we can imagine the examples your documentation teaches us (1 user with several adresses):
Collection Addresses and Document Address (with future fields _id, street, blah... blah..)
Collection Users and Document User (with future fields _id, name, blah.. blah... and array_of_addresses_ids)

<?php 
use Xenus\Document;

class User extends Document
{
    public function getAddresses()
    {
        return $this->hasMany(Addresses::class, 'user_id');
    }
}

class Address extends Document
{
    public function getUser()
    {
        return $this->belongsTo(Users::class, 'user_id');
    }
}

I have 3 questions:

  1. 'user_id' in the line of hasMany(Adresses::class, 'user_id') shouldn't be the name of the field where the ids of addresses should be saved, i mean in my case 'array_of_addresses_ids' ???
  2. Ok, let's imagine It had worked with the 'user_id'... may i imagine it is an Array of ids or an Array of Address Documents.. or a Cursor of Address Documents??? I ask this, because i want to create my functions addOneAddress($newAddress), because if I use setAddress it will be only one.. no adding but replacing...
  3. Could you forgive me if this is not the right place for questioning for that? Sorry

Thank you so much.

How Can i inject Connection To All Models? :|

hello thanks for best mongo orm
but ihave a problem:

use Xenus\Collection;
use Xenus\Connection;

trait Model{
    function __construct(){
        return new Connection('mongodb://**', 'Masih');
    }
}

class Users extends Collection
{
    use Model;

    // This is the name of your collection stored in the database
    protected $name = 'users';
}



$users = new Users();
$john = ['name' => 'John'];

// Create
$m = $users->insert($john);

If you use a framework with a dependency injection container, you can configure it to automatically inject an instance of your Xenus\Connection in every collections.

how can i do create this true??

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.