Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mongoose document save() has no argument #20

Closed
JbIPS opened this issue Sep 29, 2014 · 2 comments
Closed

Mongoose document save() has no argument #20

JbIPS opened this issue Sep 29, 2014 · 2 comments

Comments

@JbIPS
Copy link

JbIPS commented Sep 29, 2014

Hi,

I'm trying to save a mongoose document with its save method. I saw in js.npm.mongoose.Model.hx:


@:native("Model")
extern class TModel<T>
extends Document<T>
implements npm.Package.RequireNamespace<"mongoose","*"> 
{
...
    public function save( fn : Callback<TModel<T>> ) : Void;
...
}

So I tried:

class MyModel extends Model<MyModelData>{}
class MyModelDOA{
     public function clone(mod: MyModel, callback: Callback<MyModel>):Void
    {
        mod.save(callback);
    }
}

But I get Function 'save' requires no arguments. The weird thing is that I can use any function on the model and it didn't trigger any compilation errors (I tried mod.hjdzjhuhef() and it compiled), like it's a Dynamic.
Is there an interference with another save function ?

@clemos
Copy link
Owner

clemos commented Oct 9, 2014

Sorry for the delay, I've been working on other stuff ;)
I believe you may want to extend js.npm.mongoose.macro.Model and not just js.npm.mongoose.Model.
Also, both extend Document, which is (for now) Dynamic, so it makes sense that you can set any value to it.
If it still doesn't work, I'd be interested in reviewing your code to have more clues regarding the context of this error.

@clemos
Copy link
Owner

clemos commented Jan 6, 2015

Closing it, as I believe it's been fixed

@clemos clemos closed this as completed Jan 6, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants