Giter Site home page Giter Site logo

Comments (4)

mde avatar mde commented on July 26, 2024

Sorry that it's so hard to bootstrap Model all by itself. You can take a look at the Mongo adapter tests to see one way to get the adapter set up and working: https://github.com/geddy/model/blob/master/test/integration/adapters/mongo/index.js#L16

from model.

acivang avatar acivang commented on July 26, 2024

@mde thank u very much,i should see it,i will comment it later!

from model.

acivang avatar acivang commented on July 26, 2024

hello @mde !
I written code like that test flow:

var model = require('model');

var Foo = function () {
    this.setAdapter('mongo', {
        dbname:"itemDB"
    });

    this.defineProperties({
        name: { type: 'string', required: true }
    });
};

Foo = model.register('Foo', Foo);

var foo = Foo.create({"name":"aci test 2015"});
var adapter = Foo.getAdapter();
adapter.connect(function(){
    foo.save();
});

it was worked! but,was it a bug?or was my code's error?

from model.

mde avatar mde commented on July 26, 2024

I think you were missing the step for actually creating and connecting the adapter in your previous code. I'm going to go ahead and close this issue -- if you continue to have problems, please feel free to reopen it!

from model.

Related Issues (20)

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.