Company•December 16, 2018
Introducing DataStax Node.js Mapper for Apache Cassandra™
const client = new Client({ contactPoints, localDataCenter, keyspace });
const videoMapper = mapper.forModel('Video');
const video = await videoMapper.get({ videoId: myVideoId });
const userVideos = await videoMapper.find({ userId: myUserId });
await videoMapper.insert({ videoId, userId, addedDate, name });
await videoMapper.update({ videoId, userId, addedDate, name: newName });
await videoMapper.remove({ videoId });
// addedDate greater than a value await videoMapper.find({ userId, addedDate: q.gt(myDate) });
mapper.client.shutdown();
const UnderscoreCqlToCamelCaseMappings = cassandra.mapping.UnderscoreCqlToCamelCaseMappings;
// Create the Mapper using the mapping options const mapper = new Mapper(client, mappingOptions);
await videoMapper.find({ userId: myUserId })
SELECT * FROM user_videos WHERE userid = ?