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

Did fork this before adopt usefull stuff and take over maintainance as package maintainance is needed #1

Open
1 of 4 tasks
lemanschik opened this issue Jul 4, 2024 · 1 comment
Assignees
Labels
documentation Improvements or additions to documentation EPIC

Comments

@lemanschik
Copy link
Owner

lemanschik commented Jul 4, 2024

Main Issues

Need to create apis and refactor to esm asap this week.

References

Copy from old issue

add helpers

Ottoman accepts scopeName and collectionName while model accepts only scopeName

Disable All exports of the cjs module i mark this a case for migration to esm only as require('es-module') lands in node 22.x

Notes

https://ottomanjs.com/docs/basic/ottoman#defining-an-ottoman-instance mainly the example to use collections

couchbaselabs#639 (comment)

To query into array values use this way:

const where_exp = {
$any: {
$expr: [{ b: { $in: ‘block2’ } }],
$satisfies: { ‘b.field3’: {$eq: “xyz”} },
}
};
this will produce this valid N1Ql query
SELECT * FROM travel-sample.inventory.hotel WHERE ANY b IN block2 SATISFIES b.field3=“xyz” END
CREATE INDEX ix1 ON  mybucket.myscope.mycollection ( DISTINCT ARRAY e FOR e IN emails END);

SELECT *
FROM  mybucket.myscope.mycollection AS c
WHERE ANY e IN emails SATISFIES e = "[email protected]" END;

Query builder syntax some thing in this lines

const where_exp = {
$any: {
$expr: [{ e: { $in: emails } }],
$satisfies: { e: {$eq: “[email protected]”} },
}
};
@lemanschik lemanschik added documentation Improvements or additions to documentation EPIC labels Jul 4, 2024
@lemanschik lemanschik self-assigned this Jul 4, 2024
@lemanschik
Copy link
Owner Author

lemanschik commented Jul 4, 2024

 console.log(1)
    await connect("couchbase://localhostdefault-bucket@appasa:appappasdasd",{  });
    console.log(2)
  const User = model('User', { name: String },{ 
    collectionName: "_default",scopeName: "_default"
  });
  console.log(3)
  const user = new User({ name: 'Jane Doe' });
  console.log(4,user)
  await start(); // This should throw if something like collection and scope not exists
  console.log(5)
  await user.save();
  console.log(6)
  console.log('Nice Job!');

  await close();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation EPIC
Projects
None yet
Development

No branches or pull requests

1 participant