CompanyDecember 16, 2018

Introducing DataStax Node.js Mapper for Apache Cassandra™

Jorge Bay Gondra
Jorge Bay Gondra
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 = ?
Discover more
DriversApache Cassandra™
Share

One-stop Data API for Production GenAI

Astra DB gives JavaScript developers a complete data API and out-of-the-box integrations that make it easier to build production RAG apps with high relevancy and low latency.