Giter Club home page Giter Club logo

meow's People

Contributors

joannis avatar obbut avatar reaperofveriod avatar robert-joosen 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  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  avatar  avatar  avatar  avatar

meow's Issues

Ability to partial update an object

A partial update for a document so that can be used with the PATCH request. It is also more bandwidth friendly if MongoDB is hosted externally.

New Query Syntax Docs

I'm trying to figure out how to use Meow 2.0.2. By now I figured out how to save but I'm totally lost regarding the Queries.

class Test: Model {
    var _id = IdObject()
    var symbol: Symbol
}

class Symbol: Codable {
    var name: String
    var number: Int
}

With this setup I'm trying to find documents by name or number (or even both).

let context = manager?.makeContext()
let query: Query = "symbol.name" == "Test"
let result = try? context?.findOne(Test.self, where: query).wait()

Or trying to have name on toplevel:

class Test: Model {
    var _id = IdObject()
    var name: String
}

let context = manager?.makeContext()
let query: Query = "name" == "Test"
let result = try? context?.findOne(Test.self, where: query).wait()

All of these result in nil. I've also tried to create the corresponding syntax:

[
  "name" : [
    "$eq" : 
    "Test"
  ]
]

Which also didn't work. So I'm wondering... what is the correct way to query for documents in Meow 2.0?

I would be willing to help and write some docs, but I'd need to know how to use Meow first :D

Meow 2.0

This issue will serve as a central discussion point for the scope of the next major (breaking) version of Meow.

Things to review:

  • Non-ObjectId _id's
  • Drop the promise to always return the same instance across different queries
  • Extend BSONs BSONEncoder and BSONDecoder to support custom encoding/decoding strategies for custom types
  • Use the custom encoding strategies to allow for non-lazy references
  • Add new Model.updated(with document: Document) API

Intelligent caching

Custom algorithms?

  • Store certain entities for 30 minutes
  • Counter based (most frequent)
  • combination (most frequent the last day)

Optional error

When properties are optional I get this error:

error: Templates/MeowVapor.ejs: TypeError: MeowVapor.ejs:10
    8| import ExtendedJSON
    9| 
 >> 10| <% include('Meow') -%>
    11| 
    12| <%
    13| // helpers

Meow:22
    20| 		%>
    21| <%- include('lib/Serializable', {serializable}) %>
 >> 22| <%- window.execute(window.serializableGenerators, serializable) %>
    23| <%
    24| 	}
    25| 

undefined is not an object (evaluating 'serializable.based["Model"]')

The class is:

import Meow
import MongoKitten
import Foundation

final class User: Model {
    var createdAt: Date?
    var updatedAt: Date?
    var deletedAt: Date?
    var active: Bool = true

// sourcery:inline:auto:User.Meow
// sourcery:end
}

Are embeded documents still possible?

Some of the documentation I've seen shows an Embeddable protocol that seems not to exist anymore. Is it possible to embed classes or can only Reference be used now?

Plural error

I want to generate this simple user:

import Meow
import MongoKitten
import Foundation

final class User: Model {
    var active: Bool = true

// sourcery:inline:auto:User.Meow
// sourcery:end
}

Ande I get this error

error: Templates/MeowVapor.ejs: ReferenceError: MeowVapor.ejs:160
    158| 
    159| <%_ } -%>
 >> 160|         <%-group%>.get("<%-plural(model.name.toLowerCase())%>", <%-model.name%>.init) { request, subject in
    161|             return try AuthenticationMiddleware.default.respond(to: request, route: MeowRoutes.<%-model.name%>_get(subject)) { request in
    162|                 return try AuthorizationMiddleware.default.respond(to: request, route: MeowRoutes.<%-model.name%>_get(subject)) { request in
    163|                     return subject

Can't find variable: plural

Multiple databases

In my project i have multiple services and each service has its own separate database and collections for security reasons. So i would love to still be able to use Meow when models have separated databases not just collections :)

Support for optionals

I'm not sure if it's feasible or already on the roadmap or whatever, but support for optional properties in models would be nice. Otherwise it looks really good

More generics

Currently, many functions require an array or other specific collection type where it's not necessary.

An example: public static func validateDatabaseIntegrity(problemLimit limit: Int = Int.max, types: [_Model.Type]) throws -> [DatabaseProblem] where types could easily be a Set, AnySequence or any other sequence of _Model.Type.

In addition to this, _Model.Type... might make the API more easy, too

Ability to make object without id

It is not always necessary that an object need an id. So is it possible to make an object without id?

See a user example below. The location dont need an id:

{
	"name": "Mr. Awesome",
	"location": {
		"lat": 10.0,
		"lng": 50.0
	}
}

Save not working

try Meow.init("mongodb://localhost/meow")
let user = User()
try user.save()
let temp = try User.findOne()
print(temp?.name)

I am running this code in Mac works fine but when I trying to connect remote MongoDB which is running in Ubuntu it prints nil, it means save not works.

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.