cassandra - Comparing two uuids in Node.js -
i have question not able find answer research on web. work on web application in node.js , cassandra. i'm working on notification system , have compare 2 uuids make sure don't send notification people make original action ( provoke notification ).
the problem that, when compare 2 uuids supposed equals, false value.
here example of code i'm working on :
console.log('user_id :', user_id.user_id); console.log("user id of current user :", this.user_id); console.log(user_id.user_id == this.user_id); console.log(user_id.user_id === this.user_id);
and here display of result :
user_id : uuid: 29f1227d-58dd-4ddb-b0fa-19b7fc02fbe8 user id of current user : uuid: 29f1227d-58dd-4ddb-b0fa-19b7fc02fbe8 false false user_id : uuid: c8f9c196-2d63-4cf0-b388-f11bfb1a476b user id of current user : uuid: 29f1227d-58dd-4ddb-b0fa-19b7fc02fbe8 false false
as can see, first uuids supposed same. generated uuid library inside nodejs cassandra driver. don't understand why can not compare them when able make request on cassandra database uuid specified.
if me, great pleasure !
as ary mentioned, contents same addresses not, comparison returns false.
the cassandra-driver's uuid object provides equals function compares raw hex string of contents of uuid use this:
> var uuid1 = uuid.fromstring('29f1227d-58dd-4ddb-b0fa-19b7fc02fbe8') > var uuid2 = uuid.fromstring('29f1227d-58dd-4ddb-b0fa-19b7fc02fbe8') > uuid1 == uuid2 false > uuid1 === uuid2 false > uuid1.equals(uuid2) true
Comments
Post a Comment