Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    kurbsdude
    @kurbsdude
    any place to find basic a tutorial showing how to use this, something like a getting started tutorial?
    find a basic*
    Ben Fonarov
    @Chuwiey
    @kurbsdude we're working on it :) but the most basic functionality is adding it as an adapter and then using Model.adapter.query(cypher, {paramsobject})
    there's also the premade functions so you can Model.create and the like
    but right now that's lest supported
    since a graph orm is a bit different from an orm
    we're working on getting it to be more of a graph orm
    kurbsdude
    @kurbsdude

    Just a small question though, I am just starting with node and sails so please don't judge me :)

    So I wanted to recreate your create function in my user controller, because i need certain properties to be unique in the database (adding unique: true in user model is not working)... so in my UserController.js I made this custom function:

    create: function (req, res, next){
    
            var collectionName = ':user';
            var params = req.params.all();
            var paramsDB = '';
    
            User.parseOne(params, function (err, result){
               if (err) return next(err);
                paramsDB = result;
            });
    
            var q = [
                'CREATE (n' + collectionName + ' { ' + paramsDB + ' })',
                'RETURN n'
            ];
    
            User.query(q, params, function (err, user){
               if (err) return next(err);
                res.json(user);
            });
    
        }

    and in the sails-neo4j adapter.js file I added this at the end

    parseOne: function(params, cb){
            var parsedParams = parseOne(params);
            cb(null, parsedParams);
        }

    But this is giving me an error:

    TypeError: object is not a function
        at module.exports.parseOne ......... .... ...

    Any suggestions?

    kurbsdude
    @kurbsdude
    Never mind :D collectionName missing on parseOne:
    parseOne: function(collectionName, params, cb){
            var parsedParams = parseOne(params);
            cb(null, parsedParams);
        }
    kurbsdude
    @kurbsdude

    but

    User.query(q, params, function (err, user){
               if (err) return next(err);
                res.json(user);
            });

    still not working

    kurbsdude
    @kurbsdude
    I solved the above questions, however I am stuck at another big issue... Attributes set at the user models for validation like required:true are completely being ignored... Also when setting syncable: true in the adapter I get tons of errors
    Ben Fonarov
    @Chuwiey
    @kurbsdude hey there
    so in regards to query, keep in mind that if you're running that in the model, then you'll need to use User.adapter.query instead of User.query due to some weirdness with waterline and sails 0.9.16
    I don't know if you're using 0.10 though, and if you are, let me know and I'll need to look into it (but you'll probably still need to use User.adapter.query
    the second issue is that if you are returning res.json in the model, then the model has no understanding of what res is
    as for required:true and syncable:true - those aren't a great fit for a nosql db like neo4j. I can't tell you that required:true will work in the way you expect it to. But we'll have to consider how that might work...
    same with syncable: true
    also, if you have some ideas, please feel free to share and we might implement them, or ask for a pull request
    unique is different, it'll probably map to a neo4j constraint, but that means you'll get an error when trying to create something not unique, and will need to handle it
    any questions you have, feel free to ask, not a problem :)
    kurbsdude
    @kurbsdude

    To make this work with User.query, I changed your adapter.js file a little, I don't know if it is the right way of doing this
    I changed query: query to something like

    query: function(collectionName, q, params, cb){
            query(q, params, cb, true);
        },

    It would be great if attributes checks like the following could be used: (for example the following attributes work with other database adapters out there)

    attributes: {
         username: {
            type: "string",
              required: true,
          },
    
          name: {
            type: "string",
              required: true
          },
    
          password: {
            type: "string",
              required: true
          },
    
          email: {
            type: "string",
              email: true,
              required: true,
          }
      }

    For example while registering a user, it would be nice to have a required:true, giving errors for empty fields

    kurbsdude
    @kurbsdude

    or attributes could also have something like

    toJSON: function(){
             var obj = this.toObject();
              delete obj.password;
              return obj;
          }

    or

    beforeCreate: function(values, next) {
              //do something ();
      }
    kurbsdude
    @kurbsdude
    basically it would be nice to understand how to use validations shown in http://sailsjs.org/#!documentation/models for this adapter :)
    roackb2
    @roackb2
    are you guys still working on this project?
    and I just took a look at the adapter file and the whole file is so thin,
    is this project currently suitable for production usage or development only?
    would you please release a minimal viable README file to let us know
    what's the current situation of this project and how could I use it?
    Thanks a lot that someone is working on neo4j adapter and I know it's hard to
    get both development and documentation done both in short time,
    but I really need some basic understanding of
    how the relationship is mapped to sails' ORM
    and design my data modeling, hope you can give me some clues.
    Ben Fonarov
    @Chuwiey
    @roackb2 hey there, we are still working on it indeed... just trying to fit it in with all the other priorities... if you'd like, I can help you here directly, and we welcome any pull requests to help us out :)
    Arunram Kalaiselvan
    @arun057
    This message was deleted
    This message was deleted
    This message was deleted
    Arunram Kalaiselvan
    @arun057
    This message was deleted
    Michael Mealling
    @mmealling
    Are there any applications that use this package? Something that can let us know how to use it would be really helpful.
    Mahesh
    @maheshchari
    Is this module supports sails 0.11?
    i am getting errors
    I think this module not production ready and in still development
    fridaystreet
    @fridaystreet
    Hi Guys, I was pleased to find someone who was building a sails adapter for neo4j. I managed to get it working, needed to mod the returned results from the find function though so it is returned in the format expected. I see you have it commented out, so wasn't too much of an issue to get it working. Once I got it running I was able to add users through my app. It uses passports and this is where it got interesting. I was hoping to see my passport nodes created and have edges to my users, but this wasn't the case. So my question is, are there any plans for edges/relationships?
    Alexis Hope
    @bambii7
    Anyone know what neo4j version this adapter is written for?
    Sri Hari Raju Penmatsa
    @srihari93
    @Chuwiey , thank you for starting the development for this adapter. Are you still developing this adapter? I could see that there is no github activity since February. If you are still actively developing this, could you post a rough estimate about when you can publish again and what other support can we expect from the new adapter?
    Charl Meyers
    @CharlMeyers
    This message was deleted

    I am having problems getting data from the database, but it is adding data correctly. I am using sails normal findOne method

    login: function (req, res) {

    // Try to look up user using the provided email address
    User.findOne({
      email: req.param('email')
    }, function foundUser(err, user) {
      if (err) return res.negotiate(err);
      if (!user) return res.notFound();
    
      // Compare password attempt from the form params to the encrypted password
      // from the database (`user.password`)
      require('machinepack-passwords').checkPassword({
        passwordAttempt: req.param('password'),
        encryptedPassword: user.encryptedPassword
      }).exec({
    
        error: function (err){
          return res.negotiate(err);
        },
    
        // If the password from the form params doesn't checkout w/ the encrypted
        // password from the database...
        incorrect: function (){
          return res.notFound();
        },
    
        success: function (){
    
          // Store user id in the user session
          req.session.me = user.id;
    
          // All done- let the client know that everything worked.
          return res.ok();
        }
      });
    });

    }

    But it does not seem to be getting any data

    joovin
    @joovin
    how to install sails-neo4j
    Andreas Gräf
    @AndreasPrometheus
    This message was deleted
    JMM
    @mmel_76_twitter
    I'm with the same situation 'HOW DO I INSTALL SAILS-NEO4J...???', there're nothing about it